From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Dev Jain <dev.jain@arm.com>
Cc: akpm@linux-foundation.org, Liam.Howlett@oracle.com,
vbabka@suse.cz, jannh@google.com, pfalcato@suse.de,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
david@redhat.com, peterx@redhat.com, ryan.roberts@arm.com,
mingo@kernel.org, libang.li@antgroup.com, maobibo@loongson.cn,
zhengqi.arch@bytedance.com, baohua@kernel.org,
anshuman.khandual@arm.com, willy@infradead.org,
ioworker0@gmail.com, yang@os.amperecomputing.com,
baolin.wang@linux.alibaba.com, ziy@nvidia.com, hughd@google.com
Subject: Re: [PATCH v3 2/2] mm: Optimize mremap() by PTE batching
Date: Tue, 27 May 2025 17:46:41 +0100 [thread overview]
Message-ID: <67cf2131-da6b-4a1d-828e-52f0ff7fd0fb@lucifer.local> (raw)
In-Reply-To: <8ef715e7-76a2-4004-ac10-3cc10912c67d@arm.com>
On Tue, May 27, 2025 at 10:08:59PM +0530, Dev Jain wrote:
>
> On 27/05/25 9:59 pm, Lorenzo Stoakes wrote:
[snip]
> > If I invoke split_huge_pmd(), I end up with a bunch of PTEs mapping the same
> > large folio. The folio itself is not split, so nr_ptes surely will be equal to
> > something >1 here right?
>
>
> Thanks for elaborating.
>
> So,
>
> Case 1: folio splitting => nr_ptes = 1 => the question of a/d bit smearing
> disappears.
>
> Case 2: page table splitting => consec PTEs point to the same large folio
> => nr_ptes > 1 => get_and_clear_full_ptes() will smear a/d bits on the
> new ptes, which is correct because we are still pointing to the same large
> folio.
>
OK awesome, I thought as much, just wanted to make sure :) we are good then.
The accessed/dirty bits really matter at a folio granularity (and especially
with respect to reclaim/writeback which both operate at folio level) so the
smearing as you say is fine.
This patch therefore looks fine, only the trivial comment fixup.
I ran the series on my x86-64 setup (fwiw) with no build/mm selftest errors.
Sorry to be a pain but could you respin with the commit message for this patch
updated to explicitly mention that the logic applies for the non-contPTE split
PTE case (and therefore also helps performance there)? That and the trivial
thing of dropping that comment.
Then we should be good for a tag unless somebody else spots something
egregious :)
Thanks for this! Good improvement.
[snip]
Cheers, Lorenzo
next prev parent reply other threads:[~2025-05-27 16:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-27 7:50 [PATCH v3 0/2] Optimize mremap() for large folios Dev Jain
2025-05-27 7:50 ` [PATCH v3 1/2] mm: Call pointers to ptes as ptep Dev Jain
2025-05-27 7:50 ` [PATCH v3 2/2] mm: Optimize mremap() by PTE batching Dev Jain
2025-05-27 10:45 ` Lorenzo Stoakes
2025-05-27 16:22 ` Dev Jain
2025-05-27 16:29 ` Lorenzo Stoakes
2025-05-27 16:38 ` Dev Jain
2025-05-27 16:46 ` Lorenzo Stoakes [this message]
2025-05-28 3:32 ` Dev Jain
2025-05-28 4:49 ` Lorenzo Stoakes
2025-05-28 6:15 ` Dev Jain
2025-05-27 10:50 ` [PATCH v3 0/2] Optimize mremap() for large folios Lorenzo Stoakes
2025-05-27 16:26 ` Dev Jain
2025-05-27 16:32 ` Lorenzo Stoakes
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=67cf2131-da6b-4a1d-828e-52f0ff7fd0fb@lucifer.local \
--to=lorenzo.stoakes@oracle.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@redhat.com \
--cc=dev.jain@arm.com \
--cc=hughd@google.com \
--cc=ioworker0@gmail.com \
--cc=jannh@google.com \
--cc=libang.li@antgroup.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=maobibo@loongson.cn \
--cc=mingo@kernel.org \
--cc=peterx@redhat.com \
--cc=pfalcato@suse.de \
--cc=ryan.roberts@arm.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
--cc=yang@os.amperecomputing.com \
--cc=zhengqi.arch@bytedance.com \
--cc=ziy@nvidia.com \
/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