diff mbox series

[RESEND,4.9] mm: add cond_resched() in gather_pte_stats()

Message ID 20210412035857.82868-1-wenyang@linux.alibaba.com
State New
Headers show
Series [RESEND,4.9] mm: add cond_resched() in gather_pte_stats() | expand

Commit Message

Wen Yang April 12, 2021, 3:58 a.m. UTC
From: Hugh Dickins <hughd@google.com>

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.

Link: http://lkml.kernel.org/r/alpine.LSU.2.11.1612052157400.13021@eggly.anvils
Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: <stable@vger.kernel.org> # 4.9.x
Reported-by: Chen si <cici.cs@alibaba-inc.com>
Signed-off-by: Baoyou Xie <baoyou.xie@aliyun.com>
Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
Signed-off-by: Zijiang Huang <zijiang.hzj@alibaba-inc.com>
---
 fs/proc/task_mmu.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Greg KH April 12, 2021, 7:14 a.m. UTC | #1
On Mon, Apr 12, 2021 at 11:58:57AM +0800, Wen Yang wrote:
> From: Hugh Dickins <hughd@google.com>
> 
> 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.
> 
> Link: http://lkml.kernel.org/r/alpine.LSU.2.11.1612052157400.13021@eggly.anvils
> Signed-off-by: Hugh Dickins <hughd@google.com>
> Acked-by: Michal Hocko <mhocko@suse.com>
> Cc: David Rientjes <rientjes@google.com>
> Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: <stable@vger.kernel.org> # 4.9.x
> Reported-by: Chen si <cici.cs@alibaba-inc.com>
> Signed-off-by: Baoyou Xie <baoyou.xie@aliyun.com>
> Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
> Signed-off-by: Zijiang Huang <zijiang.hzj@alibaba-inc.com>
> ---
>  fs/proc/task_mmu.c | 1 +
>  1 file changed, 1 insertion(+)

Now queued up, thanks.

greg k-h
diff mbox series

Patch

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 4b207b1..e6c8ead 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -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