diff options
| author | Mikulas Patocka <mpatocka@redhat.com> | 2019-05-09 14:51:27 -0400 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2019-05-09 14:51:27 -0400 |
| commit | 936b33f7243fa1e54c8f4f2febd3472cc00e66fd (patch) | |
| tree | c2e31826acd168dcbec573f6f5d60fc0d85aa7ca | |
| parent | cf12c6729c7405c06b3e1bfccac7aa7ad007e1b7 (diff) | |
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>
| -rw-r--r-- | drivers/block/brd.c | 6 |
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) | |||
| 153 | pos++; | 153 | pos++; |
| 154 | 154 | ||
| 155 | /* | 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 | |||
| 161 | /* | ||
| 156 | * This assumes radix_tree_gang_lookup always returns as | 162 | * This assumes radix_tree_gang_lookup always returns as |
| 157 | * many pages as possible. If the radix-tree code changes, | 163 | * many pages as possible. If the radix-tree code changes, |
| 158 | * so will this have to. | 164 | * so will this have to. |
