Skip to content

Commit 5dad604

Browse files
ioworker0akpm00
authored andcommitted
mm/khugepaged: keep mm in mm_slot without MMF_DISABLE_THP check
Previously, we removed the mm from mm_slot and dropped mm_count if the MMF_THP_DISABLE flag was set. However, we didn't re-add the mm back after clearing the MMF_THP_DISABLE flag. Additionally, We add a check for the MMF_THP_DISABLE flag in hugepage_vma_revalidate(). Link: https://lkml.kernel.org/r/[email protected] Fixes: 879c600 ("mm/khugepaged: bypassing unnecessary scans with MMF_DISABLE_THP check") Signed-off-by: Lance Yang <[email protected]> Suggested-by: Yang Shi <[email protected]> Reviewed-by: Yang Shi <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Minchan Kim <[email protected]> Cc: Muchun Song <[email protected]> Cc: Peter Xu <[email protected]> Cc: Zach O'Keefe <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 4c4a525 commit 5dad604

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mm/khugepaged.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ static int hugepage_vma_revalidate(struct mm_struct *mm, unsigned long address,
920920
{
921921
struct vm_area_struct *vma;
922922

923-
if (unlikely(hpage_collapse_test_exit(mm)))
923+
if (unlikely(hpage_collapse_test_exit_or_disable(mm)))
924924
return SCAN_ANY_PROCESS;
925925

926926
*vmap = vma = find_vma(mm, address);
@@ -1428,7 +1428,7 @@ static void collect_mm_slot(struct khugepaged_mm_slot *mm_slot)
14281428

14291429
lockdep_assert_held(&khugepaged_mm_lock);
14301430

1431-
if (hpage_collapse_test_exit_or_disable(mm)) {
1431+
if (hpage_collapse_test_exit(mm)) {
14321432
/* free mm_slot */
14331433
hash_del(&slot->hash);
14341434
list_del(&slot->mm_node);
@@ -2456,7 +2456,7 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages, int *result,
24562456
* Release the current mm_slot if this mm is about to die, or
24572457
* if we scanned all vmas of this mm.
24582458
*/
2459-
if (hpage_collapse_test_exit_or_disable(mm) || !vma) {
2459+
if (hpage_collapse_test_exit(mm) || !vma) {
24602460
/*
24612461
* Make sure that if mm_users is reaching zero while
24622462
* khugepaged runs here, khugepaged_exit will find

0 commit comments

Comments
 (0)