[dm-devel] [PATCH] dm-writecache: add cond_resched to a loop
Mikulas Patocka
mpatocka at redhat.com
Fri Jun 19 15:51:34 UTC 2020
Add cond_resched to a loop that fills in the mapper memory area because
the loop can be executed many times.
Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>
Cc: stable at vger.kernek.org
---
drivers/md/dm-writecache.c | 2 ++
1 file changed, 2 insertions(+)
Index: linux-2.6/drivers/md/dm-writecache.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-writecache.c 2020-05-18 15:43:24.218771000 +0200
+++ linux-2.6/drivers/md/dm-writecache.c 2020-05-18 17:13:43.239999000 +0200
@@ -282,6 +282,8 @@ static int persistent_memory_claim(struc
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);
More information about the dm-devel
mailing list