mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-30 07:34:12 +08:00
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>
This commit is contained in:
parent
cf12c6729c
commit
936b33f724
@ -152,6 +152,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,
|
||||
|
Loading…
Reference in New Issue
Block a user