From: WANG Rui <r@hev.cc>
To: david@kernel.org, usama.arif@linux.dev, willy@infradead.org,
baolin.wang@linux.alibaba.com
Cc: r@hev.cc, Liam.Howlett@oracle.com, ajd@linux.ibm.com,
akpm@linux-foundation.org, apopple@nvidia.com, baohua@kernel.org,
brauner@kernel.org, catalin.marinas@arm.com, dev.jain@arm.com,
jack@suse.cz, kees@kernel.org, kevin.brodsky@arm.com,
lance.yang@linux.dev, linux-arm-kernel@lists.infradead.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, lorenzo.stoakes@oracle.com, mhocko@suse.com,
npache@redhat.com, pasha.tatashin@soleen.com,
rmclure@linux.ibm.com, rppt@kernel.org, ryan.roberts@arm.com,
surenb@google.com, vbabka@kernel.org, viro@zeniv.linux.org.uk
Subject: Re: [PATCH v5] binfmt_elf: Align eligible read-only PT_LOAD segments to PMD_SIZE for THP
Date: Sat, 21 Mar 2026 22:21:19 +0800 [thread overview]
Message-ID: <20260321142119.102525-1-r@hev.cc> (raw)
In-Reply-To: <20260320171115.93235-1-r@hev.cc>
One clarification regarding my earlier comment about compatibility with
cont-pte.
What I meant there is that the alignment logic in my patch does work for
systems with 4K and 16K base pages, where the PMD size remains within a
practical range. In those configurations, providing PMD-level alignment
already creates the conditions needed for both THP collapse and cont-pte
coalescing.
This does not fully extend to 64K base page systems. There the PMD size
can be quite large (e.g. 512M), which exceeds the 32M cap used in my
patch, so PMD-sized alignment may not be achievable in practice.
One way to structure this could be to treat alignment in a layered manner.
My patch focuses on establishing a reliable PMD-level alignment baseline
so that THP has the opportunity to form large mappings where it is practical.
On top of that, Usama's work can further improve behavior at smaller
granularities, for example by enabling cont-pte mappings when PMD alignment
is not feasible.
/* skip non-power of two alignments as invalid */
if (!is_power_of_2(p_align))
continue;
if (p_align < PMD_SIZE && should_align_to_pmd(&cmds[i]))
p_align = PMD_SIZE;
+ else if (p_align < CONT_PTE_SIZE && should_align_to_cont_pte(&cmds[i]))
+ p_align = CONT_PTE_SIZE;
alignment = max(alignment, p_align);
}
}
With that separation of roles, the two approaches complement each other,
and we can get the benefit of both without changing the core alignment
policy in binfmt_elf.
Thanks,
Rui
prev parent reply other threads:[~2026-03-21 14:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-13 0:52 [PATCH v5] binfmt_elf: Align eligible read-only PT_LOAD segments to PMD_SIZE for THP WANG Rui
2026-03-15 3:46 ` Lance Yang
2026-03-15 4:10 ` WANG Rui
2026-03-15 13:12 ` Usama Arif
2026-03-20 11:44 ` David Hildenbrand (Arm)
2026-03-20 17:11 ` WANG Rui
2026-03-21 14:21 ` WANG Rui [this message]
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=20260321142119.102525-1-r@hev.cc \
--to=r@hev.cc \
--cc=Liam.Howlett@oracle.com \
--cc=ajd@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=brauner@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=jack@suse.cz \
--cc=kees@kernel.org \
--cc=kevin.brodsky@arm.com \
--cc=lance.yang@linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=npache@redhat.com \
--cc=pasha.tatashin@soleen.com \
--cc=rmclure@linux.ibm.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=surenb@google.com \
--cc=usama.arif@linux.dev \
--cc=vbabka@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.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