From: Mikulas Patocka <mpatocka@redhat.com>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: linux-kernel@vger.kernel.org,
Mike Anderson <andmike@linux.vnet.ibm.com>,
Alasdair Graeme Kergon <agk@redhat.com>
Subject: [PATCH] Optimize lock in queue unplugging
Date: Tue, 29 Apr 2008 15:12:21 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0804291459030.17110@engineering.redhat.com> (raw)
Hi
Mike Anderson was doing an OLTP benchmark on a computer with 48 physical
disks mapped to one logical device via device mapper.
He found that there was a slowdown on request_queue->lock in function
generic_unplug_device. The slowdown is caused by the fact that when some
code calls unplug on the device mapper, device mapper calls unplug on all
physical disks. These unplug calls take the lock, find that the queue is
already unplugged, release the lock and exit.
With the below patch, performance of the benchmark was increased by 18%
(the whole OLTP application, not just block layer microbenchmarks).
So I'm submitting this patch for upstream. I think the patch is correct,
because when more threads call simultaneously plug and unplug, it is
unspecified, if the queue is or isn't plugged (so the patch can't make
this worse). And the caller that plugged the queue should unplug it
anyway. (if it doesn't, there's 3ms timeout).
Mikulas
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
---
block/blk-core.c | 3 +++
1 file changed, 3 insertions(+)
Index: linux-2.6.25/block/blk-core.c
===================================================================
--- linux-2.6.25.orig/block/blk-core.c 2008-04-17 04:49:44.000000000 +0200
+++ linux-2.6.25/block/blk-core.c 2008-04-29 18:50:37.000000000 +0200
@@ -271,6 +271,9 @@ EXPORT_SYMBOL(__generic_unplug_device);
**/
void generic_unplug_device(struct request_queue *q)
{
+ if (likely(!blk_queue_plugged(q)))
+ return;
+
spin_lock_irq(q->queue_lock);
__generic_unplug_device(q);
spin_unlock_irq(q->queue_lock);
next reply other threads:[~2008-04-29 19:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-29 19:12 Mikulas Patocka [this message]
2008-04-29 19:25 ` Jens Axboe
2008-04-29 20:02 ` Mikulas Patocka
2008-04-29 20:05 ` Jens Axboe
2008-04-29 20:29 ` Mike Anderson
2008-04-30 7:14 ` Jens Axboe
2008-04-30 10:38 ` Alasdair G Kergon
2008-04-30 13:54 ` Mikulas Patocka
2008-05-04 19:11 ` Jens Axboe
2008-05-05 4:01 ` Mikulas Patocka
2008-05-07 7:45 ` Jens Axboe
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=Pine.LNX.4.64.0804291459030.17110@engineering.redhat.com \
--to=mpatocka@redhat.com \
--cc=agk@redhat.com \
--cc=andmike@linux.vnet.ibm.com \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@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: 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
Powered by JetHome