From: Lorenzo Stoakes <ljs@kernel.org>
To: Lance Yang <lance.yang@linux.dev>
Cc: ye.liu@linux.dev, akpm@linux-foundation.org, david@kernel.org,
liuye@kylinos.cn, ziy@nvidia.com, baolin.wang@linux.alibaba.com,
Liam.Howlett@oracle.com, npache@redhat.com,
ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm/khugepaged: use ALIGN helpers for PMD alignment
Date: Thu, 9 Apr 2026 08:36:03 +0100 [thread overview]
Message-ID: <addVRdpQRe6KPSX6@lucifer> (raw)
In-Reply-To: <20260409031242.91778-1-lance.yang@linux.dev>
On Thu, Apr 09, 2026 at 11:12:42AM +0800, Lance Yang wrote:
>
> On Thu, Apr 09, 2026 at 09:43:22AM +0800, Ye Liu wrote:
> >From: Ye Liu <liuye@kylinos.cn>
> >
> >PMD alignment in khugepaged is currently implemented using a mix of
> >rounding helpers and open-coded bitmask operations.
> >
> >Use ALIGN() and ALIGN_DOWN() consistently for PMD-sized address range
> >alignment, matching the preferred style for address and size handling.
>
> One more spot in madvise_collapse():
>
> hend = min(hend, vma->vm_end & HPAGE_PMD_MASK);
>
> Maybe switch that one to ALIGN_DOWN() as well.
Sorry to bikeshed but I'm not sure if:
hend = min(hend, ALIGN_DOWN(vma->vm_end, HPAGE_PMD_SIZE));
Really adds any clarity there, possibly better to just leave that one as-is.
>
> And there is also in try_collapse_pte_mapped_thp():
>
> unsigned long haddr = addr & HPAGE_PMD_MASK;
This one's fine though, be good to also const-ify haddr and end there.
>
> Just a thought :)
> Lance
Cheers, Lorenzo
next prev parent reply other threads:[~2026-04-09 7:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-09 1:43 [PATCH v2] mm/khugepaged: use ALIGN helpers for PMD alignment Ye Liu
2026-04-09 1:53 ` Zi Yan
2026-04-09 2:27 ` Barry Song
2026-04-09 3:12 ` Lance Yang
2026-04-09 7:36 ` Lorenzo Stoakes [this message]
2026-04-09 7:28 ` Lorenzo Stoakes
2026-04-09 7:54 ` David Hildenbrand (Arm)
2026-04-09 13:04 ` Dev Jain
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=addVRdpQRe6KPSX6@lucifer \
--to=ljs@kernel.org \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=lance.yang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liuye@kylinos.cn \
--cc=npache@redhat.com \
--cc=ryan.roberts@arm.com \
--cc=ye.liu@linux.dev \
--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