diff --git a/mm/memory.c b/mm/memory.c index 676020552b32..9e6ac954c70b 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1026,6 +1026,9 @@ again: if (pte_none(ptent)) continue; + if (need_resched()) + break; + if (pte_present(ptent)) { struct page *page; @@ -1123,8 +1126,11 @@ again: if (force_flush) { force_flush = 0; tlb_flush_mmu(tlb); - if (addr != end) - goto again; + } + + if (addr != end) { + cond_resched(); + goto again; } return addr;