The patch titled Subject: mm, thp: copying user pages must schedule on collapse has been added to the -mm tree. Its filename is mm-thp-copying-user-pages-must-schedule-on-collapse.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-thp-copying-user-pages-must-schedule-on-collapse.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-thp-copying-user-pages-must-schedule-on-collapse.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: mm, thp: copying user pages must schedule on collapse We have encountered need_resched warnings in __collapse_huge_page_copy() while doing {clear,copy}_user_highpage() over HPAGE_PMD_NR source pages. mm->mmap_sem is held for write, but the iteration is well bounded. Reschedule as needed. Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1705101426380.109808@xxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx> Cc: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/khugepaged.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff -puN mm/khugepaged.c~mm-thp-copying-user-pages-must-schedule-on-collapse mm/khugepaged.c --- a/mm/khugepaged.c~mm-thp-copying-user-pages-must-schedule-on-collapse +++ a/mm/khugepaged.c @@ -612,7 +612,8 @@ static void __collapse_huge_page_copy(pt spinlock_t *ptl) { pte_t *_pte; - for (_pte = pte; _pte < pte+HPAGE_PMD_NR; _pte++) { + for (_pte = pte; _pte < pte + HPAGE_PMD_NR; + _pte++, page++, address += PAGE_SIZE) { pte_t pteval = *_pte; struct page *src_page; @@ -651,9 +652,7 @@ static void __collapse_huge_page_copy(pt spin_unlock(ptl); free_page_and_swap_cache(src_page); } - - address += PAGE_SIZE; - page++; + cond_resched(); } } _ Patches currently in -mm which might be from rientjes@xxxxxxxxxx are mm-thp-copying-user-pages-must-schedule-on-collapse.patch fs-epoll-short-circuit-fetching-events-if-thread-has-been-killed.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