From: Yuan-Hao Hsu <aa9736195201@gmail.com>
To: Barry Song <baohua@kernel.org>
Cc: David Hildenbrand <david@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Lorenzo Stoakes <ljs@kernel.org>,
liam@infradead.org, Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/memory: reuse the whole exclusive large folio on a write fault
Date: Sat, 19 Sep 2026 15:24:45 +0800 [thread overview]
Message-ID: <20260919072445.542-1-aa9736195201@gmail.com> (raw)
In-Reply-To: <CAGsJ_4wTYLds56=iyra5FKmgnNACN9QKJH-XJ=q62G7fMvd9iA@mail.gmail.com>
On Sat, 19 Sep 2026 07:48:00 +0800, Barry Song wrote:
> I'm fine with your follow-up work, but I'd appreciate it if you could
> mention the previous work and include the link in your changelog, along
> with an explanation of how you address David's concerns.
Will do in v2.
> I think a major concern is that we may spend too much time scanning
> PTEs to determine whether we can batch them. If we don't support
> CONT-PTE, we may simply scan fewer PTEs; if we do support CONT-PTE, we
> may end up scanning more PTEs. So we need to show that the scanning
> cost is controlled and explain how it is bounded.
The walk stays within the folio, the VMA and the page table, so it
touches at most the PTEs that map this folio in this page table: 16
for a 64K folio, PTRS_PER_PTE (512 with 4K pages) at the most. Each
PTE is read once by folio_pte_batch_flags(), the same scan fork() and
mprotect() already run over these PTEs.
Measured, that is 14-20 ns per PTE. For 512 PTEs the fault takes
10 us, 1 us of it the scan, the rest marking the pages exclusive and
writing the PTEs. Those are PTEs that would otherwise each take a
420 ns fault. The pattern where the work is wasted, one store per
folio, is the one the description gives the numbers for.
> I also personally feel that both the changelog and the code are too
> long to read. Could we somehow split the changes into smaller pieces
> and describe how each of those concerns is addressed at a finer
> granularity?
Yes, and sorry for the wall of text. v2 is two patches: 1/2 handles
an aligned block of 16 PTEs, the contpte-sized version David was fine
with in 2024; 2/2 lifts that to the folio. Each has its own numbers,
the earlier discussion is linked, and the changelogs are cut to what
is needed to judge the change.
next prev parent reply other threads:[~2026-09-19 7:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 6:42 Yuan-Hao Hsu
2026-09-18 12:14 ` David Hildenbrand (Arm)
2026-09-18 18:28 ` Yuan-Hao Hsu
2026-09-18 23:48 ` Barry Song
2026-09-19 7:24 ` Yuan-Hao Hsu [this message]
2026-09-18 13:54 ` Lorenzo Stoakes (ARM)
2026-09-19 7:31 ` [PATCH v2 0/2] " Yuan-Hao Hsu
2026-09-19 7:31 ` [PATCH v2 1/2] mm/memory: reuse 16 PTEs of an " Yuan-Hao Hsu
2026-09-19 7:31 ` [PATCH v2 2/2] mm/memory: reuse the whole " Yuan-Hao Hsu
2026-09-19 10:10 ` David Hildenbrand (Arm)
2026-09-19 10:08 ` [PATCH v2 0/2] " David Hildenbrand (Arm)
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=20260919072445.542-1-aa9736195201@gmail.com \
--to=aa9736195201@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=surenb@google.com \
--cc=vbabka@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®