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 <mpato...@redhat.com>
Cc: sta...@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);

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

Reply via email to