From: Alexander Gordeev <agordeev@linux.ibm.com>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Lorenzo Stoakes <ljs@kernel.org>,
Gerald Schaefer <gerald.schaefer@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
linux-s390@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/page_vma_mapped_walk: add missing pgtable entry accessors
Date: Wed, 29 Apr 2026 15:47:15 +0200 [thread overview]
Message-ID: <f3140daa-9a7d-440e-a448-35aa8797357a-agordeev@linux.ibm.com> (raw)
In-Reply-To: <69c4c12c-7cdc-4a17-9eb7-6fb1a61f9834@kernel.org>
On Mon, Apr 27, 2026 at 11:02:50AM +0200, David Hildenbrand (Arm) wrote:
> On 4/27/26 07:20, Alexander Gordeev wrote:
> > Convert pgtable direct entry dereferences to the corresponding
> > pXdp_get() accessors. Use ptep_get_lockless() variant for PTE
> > reads when no lock is taken.
> >
> > Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
> > ---
> > mm/page_vma_mapped.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c
> > index b38a1d00c971..a4520bb10d2a 100644
> > --- a/mm/page_vma_mapped.c
> > +++ b/mm/page_vma_mapped.c
> > @@ -41,7 +41,7 @@ static bool map_pte(struct page_vma_mapped_walk *pvmw, pmd_t *pmdvalp,
> > if (!pvmw->pte)
> > return false;
> >
> > - ptent = ptep_get(pvmw->pte);
> > + ptent = ptep_get_lockless(pvmw->pte);
(*)
> > if (pte_none(ptent)) {
> > return false;
> > @@ -219,17 +219,17 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)
> > restart:
> > do {
> > pgd = pgd_offset(mm, pvmw->address);
> > - if (!pgd_present(*pgd)) {
> > + if (!pgd_present(pgdp_get(pgd))) {
> > step_forward(pvmw, PGDIR_SIZE);
> > continue;
> > }
> > p4d = p4d_offset(pgd, pvmw->address);
> > - if (!p4d_present(*p4d)) {
> > + if (!p4d_present(p4dp_get(p4d))) {
> > step_forward(pvmw, P4D_SIZE);
> > continue;
> > }
> > pud = pud_offset(p4d, pvmw->address);
> > - if (!pud_present(*pud)) {
> > + if (!pud_present(pudp_get(pud))) {
> > step_forward(pvmw, PUD_SIZE);
> > continue;
>
> Wasn't there a problem with folded page tables, where we would no longer be able
> to optimize out the folded page table accesses?
Ok, that is a different topic. I actually tried to resolve the lockless
issue(s) in (*) while the direct dereferences just seemed to be relevant
to go along (similarly to the GUP patch).
But I would rather resend ptep_get() => ptep_get_lockless() fixes for
this patch.
Would it work?
> I thought we discussed ways to resolve that. Let me dig ...
>
>
> --
> Cheers,
>
> David
Thanks!
next prev parent reply other threads:[~2026-04-29 13:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-27 5:20 Alexander Gordeev
2026-04-27 5:47 ` Anshuman Khandual
2026-04-27 8:40 ` Oscar Salvador
2026-04-27 8:49 ` Anshuman Khandual
2026-04-27 9:01 ` Alexander Gordeev
2026-04-27 9:02 ` David Hildenbrand (Arm)
2026-04-27 9:24 ` David Hildenbrand (Arm)
2026-04-29 13:47 ` Alexander Gordeev [this message]
2026-05-01 19:01 ` David Hildenbrand (Arm)
2026-05-03 6:51 ` Alexander Gordeev
2026-05-04 12:42 ` David Hildenbrand (Arm)
2026-04-30 12:11 ` kernel test robot
2026-05-02 4:54 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f3140daa-9a7d-440e-a448-35aa8797357a-agordeev@linux.ibm.com \
--to=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=gerald.schaefer@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-s390@vger.kernel.org \
--cc=ljs@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®