From: Hugh Dickins <hu...@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 <hu...@google.com>
Acked-by: Michal Hocko <mho...@suse.com>
Cc: David Rientjes <rient...@google.com>
Cc: Gerald Schaefer <gerald.schae...@de.ibm.com>
Signed-off-by: Andrew Morton <a...@linux-foundation.org>
Signed-off-by: Linus Torvalds <torva...@linux-foundation.org>
Reported-by: Chen si <cici...@alibaba-inc.com>
Signed-off-by: Baoyou Xie <baoyou....@aliyun.com>
Signed-off-by: Wen Yang <weny...@linux.alibaba.com>
Signed-off-by: Zijiang Huang <zijiang....@alibaba-inc.com>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 fs/proc/task_mmu.c |    1 +
 1 file changed, 1 insertion(+)

--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -1609,6 +1609,7 @@ static int gather_pte_stats(pmd_t *pmd,
 
        } while (pte++, addr += PAGE_SIZE, addr != end);
        pte_unmap_unlock(orig_pte, ptl);
+       cond_resched();
        return 0;
 }
 #ifdef CONFIG_HUGETLB_PAGE


Reply via email to