Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: khugepaged: set to next mm direct when mm has MMF_DISABLE_THP_COMPLETELY

When an mm with the MMF_DISABLE_THP_COMPLETELY flag is detected during
scanning, directly set khugepaged_scan.mm_slot to the next mm_slot, reduce
redundant operation.

Without this patch, entering khugepaged_scan_mm_slot() next time, we will
set khugepaged_scan.mm_slot to the next mm_slot.

With this patch, we will directly set khugepaged_scan.mm_slot to the next
mm_slot.

Link: https://lkml.kernel.org/r/20260207081613.588598-6-vernon2gm@gmail.com
Signed-off-by: Vernon Yang <yanglincheng@kylinos.cn>
Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>
Reviewed-by: Lance Yang <lance.yang@linux.dev>
Reviewed-by: Dev Jain <dev.jain@arm.com>
Reviewed-by: Barry Song <baohua@kernel.org>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Nico Pache <npache@redhat.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Vernon Yang and committed by
Andrew Morton
80a4bcac 15c578d0

+2 -2
+2 -2
mm/khugepaged.c
··· 2508 2508 VM_BUG_ON(khugepaged_scan.mm_slot != slot); 2509 2509 /* 2510 2510 * Release the current mm_slot if this mm is about to die, or 2511 - * if we scanned all vmas of this mm. 2511 + * if we scanned all vmas of this mm, or THP got disabled. 2512 2512 */ 2513 - if (hpage_collapse_test_exit(mm) || !vma) { 2513 + if (hpage_collapse_test_exit_or_disable(mm) || !vma) { 2514 2514 /* 2515 2515 * Make sure that if mm_users is reaching zero while 2516 2516 * khugepaged runs here, khugepaged_exit will find