From: Bart Van Assche <bart.vanassche@sandisk.com> To: Mike Snitzer <snitzer@redhat.com> Cc: <dm-devel@redhat.com>, Bart Van Assche <bart.vanassche@sandisk.com>, Christoph Hellwig <hch@lst.de>, <stable@vger.kernel.org> Subject: [PATCH v2 03/13] dm-mpath: Delay requeuing while path initialization is in progress Date: Thu, 27 Apr 2017 10:11:16 -0700 [thread overview] Message-ID: <20170427171126.26814-4-bart.vanassche@sandisk.com> (raw) In-Reply-To: <20170427171126.26814-1-bart.vanassche@sandisk.com> Requeuing a request immediately while path initialization is ongoing causes high CPU usage, something that is undesired. Hence delay requeuing while path initialization is in progress. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Cc: Christoph Hellwig <hch@lst.de> Cc: <stable@vger.kernel.org> --- drivers/md/dm-mpath.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index cc41e34607c3..d739688246a0 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -322,13 +322,16 @@ static int __pg_init_all_paths(struct multipath *m) return atomic_read(&m->pg_init_in_progress); } -static void pg_init_all_paths(struct multipath *m) +static int pg_init_all_paths(struct multipath *m) { unsigned long flags; + int ret; spin_lock_irqsave(&m->lock, flags); - __pg_init_all_paths(m); + ret = __pg_init_all_paths(m); spin_unlock_irqrestore(&m->lock, flags); + + return ret; } static void __switch_pg(struct multipath *m, struct priority_group *pg) @@ -485,7 +488,6 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq, struct request **__clone) { struct multipath *m = ti->private; - int r = DM_MAPIO_REQUEUE; size_t nr_bytes = blk_rq_bytes(rq); struct pgpath *pgpath; struct block_device *bdev; @@ -504,8 +506,8 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq, return -EIO; /* Failed */ } else if (test_bit(MPATHF_QUEUE_IO, &m->flags) || test_bit(MPATHF_PG_INIT_REQUIRED, &m->flags)) { - pg_init_all_paths(m); - return r; + return pg_init_all_paths(m) == 0 ? DM_MAPIO_REQUEUE : + DM_MAPIO_DELAY_REQUEUE; } memset(mpio, 0, sizeof(*mpio)); -- 2.12.2
WARNING: multiple messages have this Message-ID (diff)
From: Bart Van Assche <bart.vanassche@sandisk.com> To: Mike Snitzer <snitzer@redhat.com> Cc: dm-devel@redhat.com, Bart Van Assche <bart.vanassche@sandisk.com>, Christoph Hellwig <hch@lst.de>, stable@vger.kernel.org Subject: [PATCH v2 03/13] dm-mpath: Delay requeuing while path initialization is in progress Date: Thu, 27 Apr 2017 10:11:16 -0700 [thread overview] Message-ID: <20170427171126.26814-4-bart.vanassche@sandisk.com> (raw) In-Reply-To: <20170427171126.26814-1-bart.vanassche@sandisk.com> Requeuing a request immediately while path initialization is ongoing causes high CPU usage, something that is undesired. Hence delay requeuing while path initialization is in progress. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Cc: Christoph Hellwig <hch@lst.de> Cc: <stable@vger.kernel.org> --- drivers/md/dm-mpath.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index cc41e34607c3..d739688246a0 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -322,13 +322,16 @@ static int __pg_init_all_paths(struct multipath *m) return atomic_read(&m->pg_init_in_progress); } -static void pg_init_all_paths(struct multipath *m) +static int pg_init_all_paths(struct multipath *m) { unsigned long flags; + int ret; spin_lock_irqsave(&m->lock, flags); - __pg_init_all_paths(m); + ret = __pg_init_all_paths(m); spin_unlock_irqrestore(&m->lock, flags); + + return ret; } static void __switch_pg(struct multipath *m, struct priority_group *pg) @@ -485,7 +488,6 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq, struct request **__clone) { struct multipath *m = ti->private; - int r = DM_MAPIO_REQUEUE; size_t nr_bytes = blk_rq_bytes(rq); struct pgpath *pgpath; struct block_device *bdev; @@ -504,8 +506,8 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq, return -EIO; /* Failed */ } else if (test_bit(MPATHF_QUEUE_IO, &m->flags) || test_bit(MPATHF_PG_INIT_REQUIRED, &m->flags)) { - pg_init_all_paths(m); - return r; + return pg_init_all_paths(m) == 0 ? DM_MAPIO_REQUEUE : + DM_MAPIO_DELAY_REQUEUE; } memset(mpio, 0, sizeof(*mpio)); -- 2.12.2
next prev parent reply other threads:[~2017-04-27 17:11 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-04-27 17:11 [PATCH v2 00/13] Device mapper and dm-mpath patches Bart Van Assche 2017-04-27 17:11 ` [PATCH v2 01/13] dm-mpath: Split activate_path() Bart Van Assche 2017-04-27 17:11 ` Bart Van Assche 2017-04-28 5:59 ` [dm-devel] " Hannes Reinecke 2017-04-28 5:59 ` Hannes Reinecke 2017-04-27 17:11 ` [PATCH v2 02/13] dm-mpath: Avoid that path removal can trigger an infinite loop Bart Van Assche 2017-04-27 17:11 ` Bart Van Assche 2017-04-28 5:59 ` [dm-devel] " Hannes Reinecke 2017-04-28 5:59 ` Hannes Reinecke 2017-04-27 17:11 ` Bart Van Assche [this message] 2017-04-27 17:11 ` [PATCH v2 03/13] dm-mpath: Delay requeuing while path initialization is in progress Bart Van Assche 2017-04-27 17:11 ` [PATCH v2 04/13] dm-rq: Adjust requeuing delays Bart Van Assche 2017-04-27 19:16 ` Mike Snitzer 2017-04-27 19:52 ` Bart Van Assche 2017-04-27 17:11 ` [PATCH v2 05/13] dm-mpath: Make it easier to analyze requeuing behavior Bart Van Assche 2017-04-27 19:29 ` Mike Snitzer 2017-04-27 19:57 ` Bart Van Assche 2017-04-27 17:11 ` [PATCH v2 06/13] dm-rq: Check blk_mq_register_dev() return value Bart Van Assche 2017-04-27 17:11 ` [PATCH v2 07/13] dm, persistence: Remove an unused argument from dm_block_manager_create() Bart Van Assche 2017-04-27 17:11 ` [PATCH v2 08/13] dm: Verify suspend_locking assumptions at runtime Bart Van Assche 2017-04-27 17:11 ` [PATCH v2 09/13] dm-mpath: Verify locking " Bart Van Assche 2017-04-27 17:11 ` [PATCH v2 10/13] dm: Introduce enum dm_queue_mode Bart Van Assche 2017-04-27 17:11 ` [PATCH v2 11/13] dm-mpath: Micro-optimize the hot path Bart Van Assche 2017-04-27 20:39 ` Mike Snitzer 2017-04-27 17:11 ` [PATCH v2 12/13] dm-mpath: Introduce assign_bit() Bart Van Assche 2017-04-27 17:11 ` [PATCH v2 13/13] dm, dm-mpath: Make it easier to detect unintended I/O request flushes Bart Van Assche
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=20170427171126.26814-4-bart.vanassche@sandisk.com \ --to=bart.vanassche@sandisk.com \ --cc=dm-devel@redhat.com \ --cc=hch@lst.de \ --cc=snitzer@redhat.com \ --cc=stable@vger.kernel.org \ /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: linkBe 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.