Skip to contentSkip to conversation

mm: add cond_resched() in gather_pte_stats()

PATCH RESEND In review Wen Yang 2 participants 2 messages Apr 12, 2021 Stable branch

lore
Share & tools
lore

Wen Yang

author
#0 lore raw

PATCH RESEND 1/1 mm: add cond_resched() in gather_pte_stats()

From: Hugh Dickins <[email protected]>

commit a66c0410b97c07a5708881198528ce724f7a3226 upstream.

The other pagetable walks in task_mmu.c have a cond_resched() after walking their ptes: add a cond_resched() in gather_pte_stats() too, for reading /proc/<id>/numa_maps. Only pagemap_pmd_range() has a cond_resched() in its (unusually expensive) pmd_trans_huge case: more should probably be added, but leave them unchanged for now.

---
 fs/proc/task_mmu.c | 1 +
 1 file changed, 1 insertion(+)
fs/proc/task_mmu.c +1 -0
index 4b207b1..e6c8ead 100644
@@ -1609,6 +1609,7 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr,
 
 	} while (pte++, addr += PAGE_SIZE, addr != end);
 	pte_unmap_unlock(orig_pte, ptl);
+	cond_resched();
 	return 0;
 }
 #ifdef CONFIG_HUGETLB_PAGE
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 22 lines · Wen Yang

From: Hugh Dickins <[email protected]>

commit a66c0410b97c07a5708881198528ce724f7a3226 upstream.

The other pagetable walks in task_mmu.c have a cond_resched() after walking their ptes: add a cond_resched() in gather_pte_stats() too, for reading /proc/<id>/numa_maps. Only pagemap_pmd_range() has a cond_resched() in its (unusually expensive) pmd_trans_huge case: more should probably be added, but leave them unchanged for now.

Quoted 3 lines
---
 fs/proc/task_mmu.c | 1 +
 1 file changed, 1 insertion(+)

Now queued up, thanks.

greg k-h