The patch titled Subject: fs, proc: unconditional cond_resched when reading smaps has been added to the -mm tree. Its filename is fs-proc-unconditional-cond_resched-when-reading-smaps.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/fs-proc-unconditional-cond_resched-when-reading-smaps.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/fs-proc-unconditional-cond_resched-when-reading-smaps.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: David Rientjes <rientjes@xxxxxxxxxx> Subject: fs, proc: unconditional cond_resched when reading smaps If there are large numbers of hugepages to iterate while reading /proc/pid/smaps, the page walk never does cond_resched(). On archs without split pmd locks, there can be significant and observable contention on mm->page_table_lock which cause lengthy delays without rescheduling. Always reschedule in smaps_pte_range() if necessary since the pagewalk iteration can be expensive. Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1708211405520.131071@xxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx> Cc: Minchan Kim <minchan@xxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/proc/task_mmu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff -puN fs/proc/task_mmu.c~fs-proc-unconditional-cond_resched-when-reading-smaps fs/proc/task_mmu.c --- a/fs/proc/task_mmu.c~fs-proc-unconditional-cond_resched-when-reading-smaps +++ a/fs/proc/task_mmu.c @@ -611,11 +611,11 @@ static int smaps_pte_range(pmd_t *pmd, u if (pmd_present(*pmd)) smaps_pmd_entry(pmd, addr, walk); spin_unlock(ptl); - return 0; + goto out; } if (pmd_trans_unstable(pmd)) - return 0; + goto out; /* * The mmap_sem held all the way back in m_start() is what * keeps khugepaged out of here and from collapsing things @@ -625,6 +625,7 @@ static int smaps_pte_range(pmd_t *pmd, u for (; addr != end; pte++, addr += PAGE_SIZE) smaps_pte_entry(pte, addr, walk); pte_unmap_unlock(pte - 1, ptl); +out: cond_resched(); return 0; } _ Patches currently in -mm which might be from rientjes@xxxxxxxxxx are mm-oom-let-oom_reap_task-and-exit_mmap-to-run-concurrently-fix-2.patch mm-compaction-kcompactd-should-not-ignore-pageblock-skip.patch mm-compaction-persistently-skip-hugetlbfs-pageblocks.patch mm-compaction-persistently-skip-hugetlbfs-pageblocks-fix.patch fs-proc-unconditional-cond_resched-when-reading-smaps.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html