Skip to content

Commit de2e517

Browse files
Kefeng Wangakpm00
authored andcommitted
mm: add cond_resched() in swapin_walk_pmd_entry()
When handling MADV_WILLNEED in madvise(), a soflockup may occurr in swapin_walk_pmd_entry() if swapping in lots of memory on a slow device. Add a cond_resched() to avoid the possible softlockup. Link: https://lkml.kernel.org/r/[email protected] Fixes: 1998cc0 ("mm: make madvise(MADV_WILLNEED) support swap file prefetch") Signed-off-by: Kefeng Wang <[email protected]> Cc: Shaohua Li <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Rik van Riel <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 8614d6c commit de2e517

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

mm/madvise.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ static int swapin_walk_pmd_entry(pmd_t *pmd, unsigned long start,
223223
put_page(page);
224224
}
225225
swap_read_unplug(splug);
226+
cond_resched();
226227

227228
return 0;
228229
}

0 commit comments

Comments
 (0)