public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	kenneth.w.chen@intel.com, Andrew Morton <akpm@osdl.org>,
	thornber@redhat.com
Subject: Re: [PATCH] backing dev unplugging
Date: Wed, 10 Mar 2004 21:19:05 +0100	[thread overview]
Message-ID: <20040310201905.GG15087@suse.de> (raw)
In-Reply-To: <404F7727.8080806@pobox.com>

On Wed, Mar 10 2004, Jeff Garzik wrote:
> Jens Axboe wrote:
> >Hi,
> >
> >Here's a first cut at killing global plugging of block devices to reduce
> >the nasty contention blk_plug_lock caused. This introduceds per-queue
> >plugging, controlled by the backing_dev_info. Observations:
> >
> >- Most uses of blk_run_queues() without a specific context was bogus.
> >  Usually the act of kicking the targets in question should be (and
> >  already are) performed by other activities, such as making the vm
> >  flushing run to free memory.
> >
> >- Some use of blk_run_queues() really just want to kick the final queue
> >  where the bio goes to. I've added bio_sync() (BIO_RW_SYNC) to manage
> >  those, if the queue needs unplugging we'll do it when holding the lock
> >  for the queue already.
> >
> >- The dm bit needs careful examination and checking of Joe. It could be
> >  more clever and maintain plug state of each target, I just added a
> >  dm_table unplug all functionality.
> >
> >Patch is against 2.6.4-rc2-mm1.
> 
> I like it a lot.

Thanks

> Any chance some of these newly-shortened functions can become static 
> inline as well?

Yeah most likely. Remember this is just a first version, there's room
for a little cleanup here and there for sure.

> >@@ -1100,13 +1092,11 @@
> > 	 * don't plug a stopped queue, it must be paired with 
> > 	 blk_start_queue()
> > 	 * which will restart the queueing
> > 	 */
> >-	if (!blk_queue_plugged(q)
> >-	    && !test_bit(QUEUE_FLAG_STOPPED, &q->queue_flags)) {
> >-		spin_lock(&blk_plug_lock);
> >-		list_add_tail(&q->plug_list, &blk_plug_list);
> >+	if (test_bit(QUEUE_FLAG_STOPPED, &q->queue_flags))
> >+		return;
> >+
> >+	if (!test_and_set_bit(QUEUE_FLAG_PLUGGED, &q->queue_flags))
> > 		mod_timer(&q->unplug_timer, jiffies + q->unplug_delay);
> >-		spin_unlock(&blk_plug_lock);
> >-	}
> > }
> > 
> > EXPORT_SYMBOL(blk_plug_device);
> >@@ -1118,15 +1108,12 @@
> > int blk_remove_plug(request_queue_t *q)
> > {
> > 	WARN_ON(!irqs_disabled());
> >-	if (blk_queue_plugged(q)) {
> >-		spin_lock(&blk_plug_lock);
> >-		list_del_init(&q->plug_list);
> >-		del_timer(&q->unplug_timer);
> >-		spin_unlock(&blk_plug_lock);
> >-		return 1;
> >-	}
> > 
> >-	return 0;
> >+	if (!test_and_clear_bit(QUEUE_FLAG_PLUGGED, &q->queue_flags))
> >+		return 0;
> >+
> >+	del_timer(&q->unplug_timer);
> >+	return 1;
> > }
> > 
> > EXPORT_SYMBOL(blk_remove_plug);
> 
> I tend to like
> 
> 	if (test_and_clear_bit())
> 		call_out_of_line_function()
> 
> style for small functions like this, and inline those.

I like to do

	if (expected condition)
		do_stuff

	slow_path

-- 
Jens Axboe


  reply	other threads:[~2004-03-10 20:22 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-10 12:45 [PATCH] backing dev unplugging Jens Axboe
2004-03-10 19:55 ` Andrew Morton
2004-03-10 20:03   ` Kenneth Chen
2004-03-10 20:20     ` Jens Axboe
2004-03-10 20:45       ` Jesse Barnes
2004-03-10 20:49         ` Jens Axboe
     [not found]           ` <20040310205237.GK15087@suse.de>
2004-03-10 21:01             ` Jesse Barnes
2004-03-10 21:02               ` Jens Axboe
2004-03-10 21:35                 ` Jesse Barnes
2004-03-10 23:54                   ` Andrew Morton
2004-03-11  0:03                     ` David Mosberger
2004-03-11  6:30                       ` Jesse Barnes
2004-03-10 20:17   ` Jens Axboe
2004-03-15  5:53   ` Kenneth Chen
2004-03-10 20:14 ` Jeff Garzik
2004-03-10 20:19   ` Jens Axboe [this message]
2004-03-10 21:00 ` Andrew Morton
2004-03-10 21:02   ` Jens Axboe
2004-03-10 21:40     ` Miquel van Smoorenburg
2004-03-10 23:05       ` Andrew Morton
2004-03-11  0:05         ` Miquel van Smoorenburg
2004-03-11  0:17           ` Andrew Morton
2004-03-11  6:43         ` Jens Axboe
2004-03-10 22:22 ` Nathan Scott
2004-03-10 23:32   ` Steve Lord
2004-03-11  7:05   ` Jens Axboe
2004-03-11  9:14 ` Joe Thornber
2004-03-11  9:16   ` Jens Axboe
2004-03-11 12:17 ` Christophe Saout
2004-03-11 12:22   ` Jens Axboe
2004-03-11 13:11     ` Christophe Saout

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=20040310201905.GG15087@suse.de \
    --to=axboe@suse.de \
    --cc=akpm@osdl.org \
    --cc=jgarzik@pobox.com \
    --cc=kenneth.w.chen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thornber@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