summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@kernel.org>2023-02-16 15:31:08 -0500
committerMike Snitzer <snitzer@kernel.org>2023-02-17 14:49:12 -0500
commit76227f6dc805e9e960128bcc6276647361e0827c (patch)
tree0c977877005aeafbc29bb527ea1514b8dc2d25a5
parente4f80303c2353952e6e980b23914e4214487f2a6 (diff)
downloadlwn-76227f6dc805e9e960128bcc6276647361e0827c.tar.gz
lwn-76227f6dc805e9e960128bcc6276647361e0827c.zip
dm cache: add cond_resched() to various workqueue loops
Otherwise on resource constrained systems these workqueues may be too greedy. Signed-off-by: Mike Snitzer <snitzer@kernel.org>
-rw-r--r--drivers/md/dm-cache-target.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
index 23195701dc15..dbbcfa580078 100644
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -1829,6 +1829,7 @@ static void process_deferred_bios(struct work_struct *ws)
else
commit_needed = process_bio(cache, bio) || commit_needed;
+ cond_resched();
}
if (commit_needed)
@@ -1852,6 +1853,7 @@ static void requeue_deferred_bios(struct cache *cache)
while ((bio = bio_list_pop(&bios))) {
bio->bi_status = BLK_STS_DM_REQUEUE;
bio_endio(bio);
+ cond_resched();
}
}
@@ -1892,6 +1894,8 @@ static void check_migrations(struct work_struct *ws)
r = mg_start(cache, op, NULL);
if (r)
break;
+
+ cond_resched();
}
}