On Wed, 31 Jan 2024 21:12:44 +0800 Zhiguo Jiang <justinjiang@xxxxxxxx> wrote:Yes, thank you for your recognition, and I also appreciate Matthew Wilcox's
--- a/mm/rmap.cThe code comment explains what the code does. This is, as usual,
+++ b/mm/rmap.c
@@ -840,6 +840,13 @@ static bool folio_referenced_one(struct folio *folio,
int referenced = 0;
unsigned long start = address, ptes = 0;
+ /* Skip this folio if it's mapped by an exiting task */
+ if (unlikely(!atomic_read(&vma->vm_mm->mm_users)) ||
+ unlikely(test_bit(MMF_OOM_SKIP, &vma->vm_mm->flags))) {
+ pra->referenced = -1;
+ return false;
+ }
pretty obvious from reading the code!
A better comment is one which explains *why* the code is doing what it
does.