]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dm cache: add cond_resched() to various workqueue loops
authorMike Snitzer <snitzer@kernel.org>
Thu, 16 Feb 2023 20:31:08 +0000 (15:31 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 15:26:43 +0000 (16:26 +0100)
[ Upstream commit 76227f6dc805e9e960128bcc6276647361e0827c ]

Otherwise on resource constrained systems these workqueues may be too
greedy.

Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/dm-cache-target.c

index 5458a069716708f09a989635f95b642cf829b16a..590aff275acb85199923010f48bf5f491b3fd1c2 100644 (file)
@@ -1952,6 +1952,7 @@ static void process_deferred_bios(struct work_struct *ws)
 
                else
                        commit_needed = process_bio(cache, bio) || commit_needed;
+               cond_resched();
        }
 
        if (commit_needed)
@@ -1974,6 +1975,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();
        }
 }
 
@@ -2014,6 +2016,8 @@ static void check_migrations(struct work_struct *ws)
                r = mg_start(cache, op, NULL);
                if (r)
                        break;
+
+               cond_resched();
        }
 }