From: Vivek Goyal <vgoyal@redhat.com>
To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
axboe@kernel.dk
Cc: vgoyal@redhat.com, arighi@develer.com, fengguang.wu@intel.com,
jack@suse.cz, akpm@linux-foundation.org
Subject: [PATCH 7/8] blk-throttle: Do not throttle WRITEs at device level except direct IO
Date: Fri, 3 Jun 2011 17:06:48 -0400 [thread overview]
Message-ID: <1307135209-30539-8-git-send-email-vgoyal@redhat.com> (raw)
In-Reply-To: <1307135209-30539-1-git-send-email-vgoyal@redhat.com>
Now WRITES are not throttled at device level except any WRITES
which are marked as DIRECT. This patch I have lifted from Andrea
Righi's previously posted series on lkml.
This will mean that any filesystem internally generated WRITES
also all not be throttled. If need be, down the line situation can
be improved if file system can give a hint to throttling logic that
it is ok to throttle certain WRITES without risk of being
serialized.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
block/blk-throttle.c | 8 ++++++++
fs/direct-io.c | 1 +
include/linux/blk_types.h | 2 ++
3 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index c8bdc59..0d63e3b 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1293,6 +1293,14 @@ int blk_throtl_bio(struct request_queue *q, struct bio **biop)
}
/*
+ * WRITES bio are throttled here only if they are directIO. Otherwise
+ * these are coming from page cache and these must have been subjected
+ * to throttling rules while process was writting to page cache.
+ */
+ if (rw == WRITE && !(bio->bi_rw & REQ_DIRECT_IO))
+ return 0;
+
+ /*
* A throtl_grp pointer retrieved under rcu can be used to access
* basic fields like stats and io rates. If a group has no rules,
* just update the dispatch stats in lockless manner and return.
diff --git a/fs/direct-io.c b/fs/direct-io.c
index ac5f164..7858828 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -361,6 +361,7 @@ static void dio_bio_submit(struct dio *dio)
unsigned long flags;
bio->bi_private = dio;
+ bio->bi_rw |= REQ_DIRECT_IO;
spin_lock_irqsave(&dio->bio_lock, flags);
dio->refcount++;
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 2a7cea5..f46e8a4 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -131,6 +131,7 @@ enum rq_flag_bits {
__REQ_RAHEAD, /* read ahead, can fail anytime */
__REQ_THROTTLED, /* This bio has already been subjected to
* throttling rules. Don't do it again. */
+ __REQ_DIRECT_IO, /* It is a direct IO operation */
/* request only flags */
__REQ_SORTED, /* elevator knows about this request */
@@ -172,6 +173,7 @@ enum rq_flag_bits {
#define REQ_RAHEAD (1 << __REQ_RAHEAD)
#define REQ_THROTTLED (1 << __REQ_THROTTLED)
+#define REQ_DIRECT_IO (1 << __REQ_DIRECT_IO)
#define REQ_SORTED (1 << __REQ_SORTED)
#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
--
1.7.4.4
next prev parent reply other threads:[~2011-06-03 21:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-03 21:06 [RFC PATCH 0/8] blk-throttle: Throttle buffered WRITE in balance_dirty_pages() Vivek Goyal
2011-06-03 21:06 ` [PATCH 1/8] blk-throttle: convert wait routines to return jiffies to wait Vivek Goyal
2011-06-03 21:06 ` [PATCH 2/8] blk-throttle: do not enforce first queued bio check in tg_wait_dispatch Vivek Goyal
2011-06-03 21:06 ` [PATCH 3/8] blk-throttle: use IO size and direction as parameters to wait routines Vivek Goyal
2011-06-03 21:06 ` [PATCH 4/8] blk-throttle: Specify number of IOs during dispatch update Vivek Goyal
2011-06-03 21:06 ` [PATCH 5/8] blk-throttle: Get rid of extend slice trace message Vivek Goyal
2011-06-03 21:06 ` [PATCH 6/8] blk-throttle: core logic to throttle task while dirtying pages Vivek Goyal
2011-06-03 21:06 ` Vivek Goyal [this message]
2011-06-03 21:06 ` [PATCH 8/8] blk-throttle: enable throttling of " Vivek Goyal
-- strict thread matches above, loose matches on Subject: below --
2011-06-28 15:35 [PATCH 0/8][V2] blk-throttle: Throttle buffered WRITEs in balance_dirty_pages() Vivek Goyal
2011-06-28 15:35 ` [PATCH 7/8] blk-throttle: do not throttle writes at device level except direct io Vivek Goyal
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=1307135209-30539-8-git-send-email-vgoyal@redhat.com \
--to=vgoyal@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=arighi@develer.com \
--cc=axboe@kernel.dk \
--cc=fengguang.wu@intel.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).