From: "Jun'ichi Nomura" <j-nomura@ce.jp.nec.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
device-mapper development <dm-devel@redhat.com>
Cc: Tejun Heo <tj@kernel.org>, Vivek Goyal <vgoyal@redhat.com>,
Jens Axboe <axboe@kernel.dk>, Alasdair G Kergon <agk@redhat.com>
Subject: Re: [PATCH 2/2] dm: stay in blk_queue_bypass until queue becomes initialized
Date: Fri, 26 Oct 2012 10:42:48 +0900 [thread overview]
Message-ID: <5089EA98.9070004@ce.jp.nec.com> (raw)
In-Reply-To: <50890937.7010809@ce.jp.nec.com>
On 10/25/12 18:41, Jun'ichi Nomura wrote:
> With 749fefe677 ("block: lift the initial queue bypass mode on
> blk_register_queue() instead of blk_init_allocated_queue()"),
> add_disk() eventually calls blk_queue_bypass_end().
> This change invokes the following warning when multipath is used.
...
> The warning means during queue initialization blk_queue_bypass_start()
> calls sleeping function (synchronize_rcu) while dm holds md->type_lock.
>
> dm device initialization basically includes the following 3 steps:
> 1. create ioctl, allocates queue and call add_disk()
> 2. table load ioctl, determines device type and initialize queue
> if request-based
> 3. resume ioctl, device becomes functional
>
> So it is better to have dm's queue stay in bypass mode until
> the initialization completes in table load ioctl.
>
> The effect of additional blk_queue_bypass_start():
>
> 3.7-rc2 (plain)
> # time for n in $(seq 1000); do dmsetup create --noudevsync --notable a; \
> dmsetup remove a; done
>
> real 0m15.434s
> user 0m0.423s
> sys 0m7.052s
>
> 3.7-rc2 (with this patch)
> # time for n in $(seq 1000); do dmsetup create --noudevsync --notable a; \
> dmsetup remove a; done
> real 0m19.766s
> user 0m0.442s
> sys 0m6.861s
>
> If this additional cost is not negligible, we need a variant of add_disk()
> that does not end bypassing.
Or call blk_queue_bypass_start() before add_disk():
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index ad02761..d14639b 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1868,9 +1868,9 @@ static struct mapped_device *alloc_dev(int minor)
md->disk->queue = md->queue;
md->disk->private_data = md;
sprintf(md->disk->disk_name, "dm-%d", minor);
- add_disk(md->disk);
/* Until md type is determined, put the queue in bypass mode */
blk_queue_bypass_start(md->queue);
+ add_disk(md->disk);
format_dev_t(md->name, MKDEV(_major, minor));
md->wq = alloc_workqueue("kdmflush",
---
If the patch is modified like above, we could fix the issue
without incurring additional cost on dm device creation.
# time for n in $(seq 1000); do dmsetup create --noudevsync --notable a; \
dmsetup remove a; done
real 0m15.684s
user 0m0.404s
sys 0m7.181s
--
Jun'ichi Nomura, NEC Corporation
next prev parent reply other threads:[~2012-10-26 1:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-25 9:41 [PATCH 2/2] dm: stay in blk_queue_bypass until queue becomes initialized Jun'ichi Nomura
2012-10-26 1:42 ` Jun'ichi Nomura [this message]
2012-10-26 20:21 ` Vivek Goyal
2012-10-29 10:15 ` Jun'ichi Nomura
2012-10-29 16:38 ` Vivek Goyal
2012-10-29 16:45 ` Peter Zijlstra
2012-10-29 17:13 ` Vivek Goyal
2012-10-30 2:25 ` [PATCH] blkcg: fix "scheduling while atomic" in blk_queue_bypass_start Jun'ichi Nomura
2012-10-30 13:21 ` Vivek Goyal
2013-01-08 7:31 ` [PATCH repost] " Jun'ichi Nomura
2013-01-09 15:52 ` Vivek Goyal
2013-01-09 15:55 ` Tejun Heo
2013-02-26 4:53 ` Jun'ichi Nomura
2012-10-29 16:55 ` [PATCH 2/2] dm: stay in blk_queue_bypass until queue becomes initialized Paul E. McKenney
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=5089EA98.9070004@ce.jp.nec.com \
--to=j-nomura@ce.jp.nec.com \
--cc=agk@redhat.com \
--cc=axboe@kernel.dk \
--cc=dm-devel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
--cc=vgoyal@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox