summaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorMikulas Patocka2019-05-09 20:51:27 +0200
committerJens Axboe2019-05-09 20:51:27 +0200
commit936b33f7243fa1e54c8f4f2febd3472cc00e66fd (patch)
treec2e31826acd168dcbec573f6f5d60fc0d85aa7ca /drivers/block
parentsata_rcar: Remove ata_host_alloc() error printing (diff)
downloadkernel-qcow2-linux-936b33f7243fa1e54c8f4f2febd3472cc00e66fd.tar.gz
kernel-qcow2-linux-936b33f7243fa1e54c8f4f2febd3472cc00e66fd.tar.xz
kernel-qcow2-linux-936b33f7243fa1e54c8f4f2febd3472cc00e66fd.zip
brd: add cond_resched to brd_free_pages
The loop that frees all the pages can take unbounded amount of time, so add cond_resched() to it. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/brd.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 17defbf4f332..2da615b45b31 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -153,6 +153,12 @@ static void brd_free_pages(struct brd_device *brd)
pos++;
/*
+ * It takes 3.4 seconds to remove 80GiB ramdisk.
+ * So, we need cond_resched to avoid stalling the CPU.
+ */
+ cond_resched();
+
+ /*
* This assumes radix_tree_gang_lookup always returns as
* many pages as possible. If the radix-tree code changes,
* so will this have to.