Skip to content

Commit d35bd76

Browse files
Mikulas Patockasnitm
authored andcommitted
dm writecache: add cond_resched to loop in persistent_memory_claim()
Add cond_resched() to a loop that fills in the mapper memory area because the loop can be executed many times. Fixes: 48debaf ("dm: add writecache target") Cc: [email protected] Signed-off-by: Mikulas Patocka <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent f2cd9a5 commit d35bd76

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/md/dm-writecache.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ static int persistent_memory_claim(struct dm_writecache *wc)
282282
while (daa-- && i < p) {
283283
pages[i++] = pfn_t_to_page(pfn);
284284
pfn.val++;
285+
if (!(i & 15))
286+
cond_resched();
285287
}
286288
} while (i < p);
287289
wc->memory_map = vmap(pages, p, VM_MAP, PAGE_KERNEL);

0 commit comments

Comments
 (0)