Skip to content

Commit 936b33f

Browse files
Mikulas Patockaaxboe
authored andcommitted
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 <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent cf12c67 commit 936b33f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/block/brd.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ static void brd_free_pages(struct brd_device *brd)
152152

153153
pos++;
154154

155+
/*
156+
* It takes 3.4 seconds to remove 80GiB ramdisk.
157+
* So, we need cond_resched to avoid stalling the CPU.
158+
*/
159+
cond_resched();
160+
155161
/*
156162
* This assumes radix_tree_gang_lookup always returns as
157163
* many pages as possible. If the radix-tree code changes,

0 commit comments

Comments
 (0)