All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@kernel.org>
To: dm-devel@redhat.com
Cc: Mike Snitzer <snitzer@kernel.org>
Subject: [dm-devel] [PATCH 4/6] dm cache: add cond_resched() to various workqueue loops
Date: Fri, 17 Feb 2023 15:07:35 -0500	[thread overview]
Message-ID: <20230217200737.12481-5-snitzer@kernel.org> (raw)
In-Reply-To: <20230217200737.12481-1-snitzer@kernel.org>

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

Signed-off-by: Mike Snitzer <snitzer@kernel.org>
---
 drivers/md/dm-cache-target.c | 4 ++++
 1 file changed, 4 insertions(+)

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();
 	}
 }
 
-- 
2.37.0 (Apple Git-136)

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


  parent reply	other threads:[~2023-02-17 20:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17 20:07 [dm-devel] [PATCH 0/6] dm: some changes just staged for 6.3 Mike Snitzer
2023-02-17 20:07 ` [dm-devel] [PATCH 1/6] dm: add cond_resched() to dm_wq_work() Mike Snitzer
2023-02-17 20:07 ` [dm-devel] [PATCH 2/6] dm: add cond_resched() to dm_wq_requeue_work() Mike Snitzer
2023-02-17 20:07 ` [dm-devel] [PATCH 3/6] dm thin: add cond_resched() to various workqueue loops Mike Snitzer
2023-02-17 20:07 ` Mike Snitzer [this message]
2023-02-17 20:07 ` [dm-devel] [PATCH 5/6] dm ioctl: assert _hash_lock is held in __hash_remove Mike Snitzer
2023-02-17 20:07 ` [dm-devel] [PATCH 6/6] dm ioctl: remove unnecessary check when using dm_get_mdptr() Mike Snitzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230217200737.12481-5-snitzer@kernel.org \
    --to=snitzer@kernel.org \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.