[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240513074712.7608-4-ioworker0@gmail.com>
Date: Mon, 13 May 2024 15:47:11 +0800
From: Lance Yang <ioworker0@...il.com>
To: akpm@...ux-foundation.org
Cc: willy@...radead.org,
sj@...nel.org,
baolin.wang@...ux.alibaba.com,
maskray@...gle.com,
ziy@...dia.com,
ryan.roberts@....com,
david@...hat.com,
21cnbao@...il.com,
mhocko@...e.com,
fengwei.yin@...el.com,
zokeefe@...gle.com,
shy828301@...il.com,
xiehuan09@...il.com,
libang.li@...group.com,
wangkefeng.wang@...wei.com,
songmuchun@...edance.com,
peterx@...hat.com,
minchan@...nel.org,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Lance Yang <ioworker0@...il.com>
Subject: [PATCH RESEND v5 3/4] mm/mlock: check for THP missing the mlock in try_to_unmap_one()
The TTU_SPLIT_HUGE_PMD will no longer perform immediately, so we might
encounter a PMD-mapped THP missing the mlock in the VM_LOCKED range
during the pagewalk. It's likely necessary to mlock this THP to prevent
it from being picked up during page reclaim.
Suggested-by: Baolin Wang <baolin.wang@...ux.alibaba.com>
Signed-off-by: Lance Yang <ioworker0@...il.com>
---
mm/rmap.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/rmap.c b/mm/rmap.c
index 4c4d14325f2e..08a93347f283 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1671,7 +1671,8 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma,
if (!(flags & TTU_IGNORE_MLOCK) &&
(vma->vm_flags & VM_LOCKED)) {
/* Restore the mlock which got missed */
- if (!folio_test_large(folio))
+ if (!folio_test_large(folio) ||
+ (!pvmw.pte && (flags & TTU_SPLIT_HUGE_PMD)))
mlock_vma_folio(folio, vma);
goto walk_done_err;
}
--
2.33.1
Powered by blists - more mailing lists