diff --git a/mm/memory.c b/mm/memory.c index 116ca8c7741f..2db265872522 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1333,6 +1333,9 @@ again: if (pte_none(ptent)) continue; + if (need_resched()) + break; + if (pte_present(ptent)) { struct page *page; @@ -1431,8 +1434,11 @@ again: if (force_flush) { force_flush = 0; tlb_flush_mmu_free(tlb); - if (addr != end) - goto again; + } + + if (addr != end) { + cond_resched(); + goto again; } return addr;