mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shaohua Li <shaohua.li@intel.com>
To: Jens Axboe <jaxboe@fusionio.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: [patch]block: document blk_plug
Date: Fri, 29 Jul 2011 11:13:35 +0800	[thread overview]
Message-ID: <1311909215.15392.418.camel@sli10-conroe> (raw)

Andrew Morton is asking to document blk_plug, so here is my attempt.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
---
 include/linux/blkdev.h |   11 +++++++++++
 1 file changed, 11 insertions(+)

Index: linux/include/linux/blkdev.h
===================================================================
--- linux.orig/include/linux/blkdev.h	2011-07-29 10:51:29.000000000 +0800
+++ linux/include/linux/blkdev.h	2011-07-29 11:07:49.000000000 +0800
@@ -858,6 +858,17 @@ struct request_queue *blk_alloc_queue_no
 extern void blk_put_queue(struct request_queue *);
 
 /*
+ * blk_plug gives each task a request list. Since blk_start_plug() called,
+ * requests from the task will be added to the per-task list and then moved
+ * to global request_queue in a batch way at appropriate time(either
+ * blk_finish_plug() is called or task goes to sleep). blk_plug has some
+ * advantages:
+ * 1. Better request merge. The assumption here is requests from a task have
+ *    better chances to be merged.
+ * 2. Better scalability. Requests are moved from per-task list to global
+ *    request_queue in a batch way, so the total times grabing global
+ *    request_queue lock are reduced.
+ *
  * Note: Code in between changing the blk_plug list/cb_list or element of such
  * lists is preemptable, but such code can't do sleep (or be very careful),
  * otherwise data is corrupted. For details, please check schedule() where



             reply	other threads:[~2011-07-29  3:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-29  3:13 Shaohua Li [this message]
2011-07-29 12:14 ` Suresh Jayaraman
2011-08-02  0:46   ` Shaohua Li
2011-08-26 22:25     ` Andrew Morton
2011-08-27  1:22       ` Jonathan Corbet
2011-08-27  6:36       ` 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=1311909215.15392.418.camel@sli10-conroe \
    --to=shaohua.li@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=jaxboe@fusionio.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

all inboxes | Powered by JetHome®