All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dm-mpath: Requeue after a small delay if blk_get_request() fails
@ 2017-04-07 23:50 Bart Van Assche
  2017-04-21 20:34 ` Bart Van Assche
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2017-04-07 23:50 UTC (permalink / raw)
  To: Mike Snitzer; +Cc: device-mapper development

If blk_get_request() returns ENODEV then multipath_clone_and_map()
causes a request to be requeued immediately. This can cause a
kworker thread to spend 100% of the CPU time of a single core in
__blk_mq_run_hw_queue() and also can cause device removal to
never finish.

Avoid this by only requeuing after a delay if blk_get_request()
fails. Additionally, reduce the requeue delay.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: <stable@vger.kernel.org>
---
 drivers/md/dm-mpath.c | 2 +-
 drivers/md/dm-rq.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 39f9549b3300..e70f0e5bfcaf 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -517,7 +517,7 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq,
 			GFP_ATOMIC);
 	if (IS_ERR(clone)) {
 		/* EBUSY, ENODEV or EWOULDBLOCK: requeue */
-		return r;
+		return DM_MAPIO_DELAY_REQUEUE;
 	}
 	clone->bio = clone->biotail = NULL;
 	clone->rq_disk = bdev->bd_disk;
diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c
index 5f4e0c47516d..f3f986b08b6a 100644
--- a/drivers/md/dm-rq.c
+++ b/drivers/md/dm-rq.c
@@ -280,7 +280,7 @@ static void dm_requeue_original_request(struct dm_rq_target_io *tio, bool delay_
 	if (!rq->q->mq_ops)
 		dm_old_requeue_request(rq);
 	else
-		dm_mq_delay_requeue_request(rq, delay_requeue ? 5000 : 0);
+		dm_mq_delay_requeue_request(rq, delay_requeue ? 100/*ms*/ : 0);
 
 	rq_completed(md, rw, false);
 }
-- 
2.12.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dm-mpath: Requeue after a small delay if blk_get_request() fails
  2017-04-07 23:50 [PATCH] dm-mpath: Requeue after a small delay if blk_get_request() fails Bart Van Assche
@ 2017-04-21 20:34 ` Bart Van Assche
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Van Assche @ 2017-04-21 20:34 UTC (permalink / raw)
  To: snitzer@redhat.com; +Cc: dm-devel@redhat.com

On Fri, 2017-04-07 at 16:50 -0700, Bart Van Assche wrote:
> If blk_get_request() returns ENODEV then multipath_clone_and_map()
> causes a request to be requeued immediately. This can cause a
> kworker thread to spend 100% of the CPU time of a single core in
> __blk_mq_run_hw_queue() and also can cause device removal to
> never finish.
> 
> Avoid this by only requeuing after a delay if blk_get_request()
> fails. Additionally, reduce the requeue delay.

Hello Mike,

The v4.12 merge window will open soon. Have you already had the
time to review this patch?

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-21 20:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-07 23:50 [PATCH] dm-mpath: Requeue after a small delay if blk_get_request() fails Bart Van Assche
2017-04-21 20:34 ` Bart Van Assche

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.