[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250211111326.14295-16-dev.jain@arm.com>
Date: Tue, 11 Feb 2025 16:43:24 +0530
From: Dev Jain <dev.jain@....com>
To: akpm@...ux-foundation.org,
david@...hat.com,
willy@...radead.org,
kirill.shutemov@...ux.intel.com
Cc: npache@...hat.com,
ryan.roberts@....com,
anshuman.khandual@....com,
catalin.marinas@....com,
cl@...two.org,
vbabka@...e.cz,
mhocko@...e.com,
apopple@...dia.com,
dave.hansen@...ux.intel.com,
will@...nel.org,
baohua@...nel.org,
jack@...e.cz,
srivatsa@...il.mit.edu,
haowenchao22@...il.com,
hughd@...gle.com,
aneesh.kumar@...nel.org,
yang@...amperecomputing.com,
peterx@...hat.com,
ioworker0@...il.com,
wangkefeng.wang@...wei.com,
ziy@...dia.com,
jglisse@...gle.com,
surenb@...gle.com,
vishal.moola@...il.com,
zokeefe@...gle.com,
zhengqi.arch@...edance.com,
jhubbard@...dia.com,
21cnbao@...il.com,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Dev Jain <dev.jain@....com>
Subject: [PATCH v2 15/17] khugepaged: Delay cond_resched()
Post scanning VMAs less than PMD-size, cond_resched() may get called at
a frequency of 1 << order worth of pte scan. Earlier, this was at a
PMD-worth scan. Therefore, manually enforce the previous behaviour; not
doing this causes the khugepaged selftest to timeout.
Signed-off-by: Dev Jain <dev.jain@....com>
---
mm/khugepaged.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 7c9a758f6817..d2bb008b95e7 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -2650,6 +2650,7 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages, int *result,
unsigned long orders;
int order;
bool is_file_vma;
+ int prev_progress = 0;
VM_BUG_ON(!pages);
lockdep_assert_held(&khugepaged_mm_lock);
@@ -2730,7 +2731,10 @@ static unsigned int khugepaged_scan_mm_slot(unsigned int pages, int *result,
while (khugepaged_scan.address < hend) {
bool mmap_locked = true;
- cond_resched();
+ if (progress - prev_progress >= HPAGE_PMD_NR) {
+ cond_resched();
+ prev_progress = progress;
+ }
if (unlikely(hpage_collapse_test_exit_or_disable(mm)))
goto breakouterloop;
--
2.30.2
Powered by blists - more mailing lists