[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1EF78444-75F3-4483-B499-DD49ABCDE6FF@nvidia.com>
Date: Fri, 03 Oct 2025 13:04:25 -0400
From: Zi Yan <ziy@...dia.com>
To: Lance Yang <lance.yang@...ux.dev>
Cc: akpm@...ux-foundation.org, david@...hat.com, lorenzo.stoakes@...cle.com,
baolin.wang@...ux.alibaba.com, Liam.Howlett@...cle.com, npache@...hat.com,
ryan.roberts@....com, dev.jain@....com, baohua@...nel.org,
ioworker0@...il.com, richard.weiyang@...il.com, linux-kernel@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [PATCH mm-new 1/2] mm/khugepaged: optimize PTE scanning with
if-else-if-else-if chain
On 2 Oct 2025, at 3:32, Lance Yang wrote:
> From: Lance Yang <lance.yang@...ux.dev>
>
> As pointed out by Dev, the PTE checks for disjoint conditions in the
> scanning loops can be optimized. is_swap_pte, (pte_none && is_zero_pfn),
> and pte_uffd_wp are mutually exclusive.
>
> This patch refactors the loops in both __collapse_huge_page_isolate() and
> hpage_collapse_scan_pmd() to use a continuous if-else-if-else-if chain
> instead of separate if blocks.
>
> Also, this is a preparatory step to make it easier to merge the
> almost-duplicated scanning logic in these two functions, as suggested
> by David.
>
> Suggested-by: Dev Jain <dev.jain@....com>
> Suggested-by: David Hildenbrand <david@...hat.com>
> Signed-off-by: Lance Yang <lance.yang@...ux.dev>
> ---
> mm/khugepaged.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
LGTM. Reviewed-by: Zi Yan <ziy@...dia.com>
Best Regards,
Yan, Zi
Powered by blists - more mailing lists