summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2020-06-19 18:51:34 +0300
committerMike Snitzer <snitzer@redhat.com>2020-06-19 19:32:24 +0300
commitd35bd764e6899a7bea71958f08d16cea5bfa1919 (patch)
treedeffd0ce137febc8e079fca0efaea8660c108ac1 /drivers/md
parentf2cd9a5e85dc25e10f6318bc6fbcb7dcff262561 (diff)
downloadlinux-d35bd764e6899a7bea71958f08d16cea5bfa1919.tar.xz
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: 48debafe4f2fe ("dm: add writecache target") Cc: stable@vger.kernel.org Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-writecache.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
index 6b28990b1d84..30505d70f423 100644
--- a/drivers/md/dm-writecache.c
+++ b/drivers/md/dm-writecache.c
@@ -282,6 +282,8 @@ static int persistent_memory_claim(struct dm_writecache *wc)
while (daa-- && i < p) {
pages[i++] = pfn_t_to_page(pfn);
pfn.val++;
+ if (!(i & 15))
+ cond_resched();
}
} while (i < p);
wc->memory_map = vmap(pages, p, VM_MAP, PAGE_KERNEL);