The loop that frees all the pages can take unbounded amount of time, so
add cond_resched() to it.

Signed-off-by: Mikulas Patocka <[email protected]>

---
 drivers/block/brd.c |    2 ++
 1 file changed, 2 insertions(+)

Index: linux-4.19.41/drivers/block/brd.c
===================================================================
--- linux-4.19.41.orig/drivers/block/brd.c      2019-01-22 12:26:42.000000000 
+0100
+++ linux-4.19.41/drivers/block/brd.c   2019-05-09 17:09:11.000000000 +0200
@@ -157,6 +157,8 @@ static void brd_free_pages(struct brd_de
 
                pos++;
 
+               cond_resched();
+
                /*
                 * This assumes radix_tree_gang_lookup always returns as
                 * many pages as possible. If the radix-tree code changes,

Reply via email to