All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Righi <righi.andrea@gmail.com>
To: Paul Menage <menage@google.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>,
	Gui Jianfeng <guijianfeng@cn.fujitsu.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	agk@sourceware.org, akpm@linux-foundation.org, axboe@kernel.dk,
	tytso@mit.edu, baramsori72@gmail.com,
	Carl Henrik Lunde <chlunde@ping.uio.no>,
	dave@linux.vnet.ibm.com, Divyesh Shah <dpshah@google.com>,
	eric.rannaud@gmail.com, fernando@oss.ntt.co.jp,
	Hirokazu Takahashi <taka@valinux.co.jp>,
	Li Zefan <lizf@cn.fujitsu.com>,
	matt@bluehost.com, dradford@bluehost.com, ngupta@google.com,
	randy.dunlap@oracle.com, roberto@unbit.it,
	Ryo Tsuruta <ryov@valinux.co.jp>,
	Satoshi UCHIDA <s-uchida@ap.jp.nec.com>,
	subrata@linux.vnet.ibm.com, yoshikawa.takuya@oss.ntt.co.jp,
	Nauman Rafique <nauman@google.com>,
	fchecconi@gmail.com, paolo.valente@unimore.it,
	m-ikeda@ds.jp.nec.com, paulmck@linux.vnet.ibm.com,
	containers@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v15 4/7] io-throttle controller infrastructure
Date: Tue, 28 Apr 2009 16:50:50 +0200	[thread overview]
Message-ID: <20090428145050.GB990@linux> (raw)
In-Reply-To: <1240908234-15434-5-git-send-email-righi.andrea@gmail.com>

On Tue, Apr 28, 2009 at 10:43:51AM +0200, Andrea Righi wrote:
> This is the core of the io-throttle kernel infrastructure. It creates
> the basic interfaces to the cgroup subsystem and implements the I/O
> measurement and throttling functionality.

Subject: io-throttle: correctly throttle O_DIRECT reads

There's a bug in the latest io-throttle patchset: the IO generated by
O_DIRECT reads is correctly accounted, but tasks doing direct IO are not
correctly throttled.

The following fix apply the correct behaviour, throttling the tasks that
are doing O_DIRECT reads directly, instead of delaying their IO
requests.

[ This patch must be applied on top of io-throttle v15 ]

Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
---
 block/blk-io-throttle.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/block/blk-io-throttle.c b/block/blk-io-throttle.c
index 380a21a..8dc2c93 100644
--- a/block/blk-io-throttle.c
+++ b/block/blk-io-throttle.c
@@ -803,12 +803,21 @@ cgroup_io_throttle(struct bio *bio, struct block_device *bdev, ssize_t bytes)
 	 * cgroup. If they're different we're doing writeback IO and we can't
 	 * throttle the current task directly.
 	 */
-	if (!is_in_dio())
+	if (!is_in_dio()) {
+		/*
+		 * We're not doing O_DIRECT: find the source of this IO
+		 * request.
+		 */
 		iot = get_iothrottle_from_bio(bio);
+	}
 	rcu_read_lock();
 	curr_iot = task_to_iothrottle(current);
-	if (curr_iot != iot) {
-		css_get(&curr_iot->css);
+	if (iot == NULL) {
+		/* IO occurs in the same context of the current task */
+		iot = curr_iot;
+		css_get(&iot->css);
+	}
+	if (iot != curr_iot) {
 		/*
 		 * IO occurs in a different context of the current task
 		 * (writeback IO).
@@ -819,10 +828,6 @@ cgroup_io_throttle(struct bio *bio, struct block_device *bdev, ssize_t bytes)
 		 */
 		can_sleep = 0;
 	}
-	if (iot == NULL) {
-		/* IO occurs in the same context of the current task */
-		iot = curr_iot;
-	}
 	/* Apply IO throttling */
 	iothrottle_evaluate_sleep(&s, iot, bdev, bytes);
 	sleep = max(s.bw_sleep, s.iops_sleep);
@@ -831,8 +836,6 @@ cgroup_io_throttle(struct bio *bio, struct block_device *bdev, ssize_t bytes)
 	if (unlikely(sleep && can_sleep))
 		iothrottle_acct_stat(iot, bdev, type, sleep);
 	css_put(&iot->css);
-	if (curr_iot != iot)
-		css_put(&curr_iot->css);
 	rcu_read_unlock();
 	if (unlikely(sleep && can_sleep)) {
 		/* Throttle the current task directly */

  reply	other threads:[~2009-04-28 14:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-28  8:43 [PATCH v15 0/7] cgroup: io-throttle controller Andrea Righi
2009-04-28  8:43 ` [PATCH v15 1/7] io-throttle documentation Andrea Righi
2009-04-28  8:43 ` [PATCH v15 2/7] res_counter: introduce ratelimiting attributes Andrea Righi
2009-04-28 14:39   ` Andrea Righi
     [not found]   ` <1240908234-15434-3-git-send-email-righi.andrea-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-04-28 14:39     ` Andrea Righi
2009-04-28  8:43 ` [PATCH v15 3/7] page_cgroup: provide a generic page tracking infrastructure Andrea Righi
     [not found] ` <1240908234-15434-1-git-send-email-righi.andrea-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-04-28  8:43   ` [PATCH v15 1/7] io-throttle documentation Andrea Righi
2009-04-28  8:43   ` [PATCH v15 2/7] res_counter: introduce ratelimiting attributes Andrea Righi
2009-04-28  8:43   ` [PATCH v15 3/7] page_cgroup: provide a generic page tracking infrastructure Andrea Righi
2009-04-28  8:43   ` [PATCH v15 4/7] io-throttle controller infrastructure Andrea Righi
2009-04-28  8:43   ` [PATCH v15 5/7] kiothrottled: throttle buffered (writeback) IO Andrea Righi
2009-04-28  8:43   ` [PATCH v15 6/7] io-throttle instrumentation Andrea Righi
2009-04-28  8:43   ` [PATCH v15 7/7] io-throttle: export per-task statistics to userspace Andrea Righi
2009-04-28  8:47   ` [PATCH v15 0/7] cgroup: io-throttle controller Andrea Righi
2009-04-28  8:43 ` [PATCH v15 4/7] io-throttle controller infrastructure Andrea Righi
2009-04-28 14:50   ` Andrea Righi [this message]
     [not found]   ` <1240908234-15434-5-git-send-email-righi.andrea-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-04-28 14:50     ` Andrea Righi
2009-04-28  8:43 ` [PATCH v15 5/7] kiothrottled: throttle buffered (writeback) IO Andrea Righi
2009-04-28  8:43 ` [PATCH v15 6/7] io-throttle instrumentation Andrea Righi
2009-04-28  8:43 ` [PATCH v15 7/7] io-throttle: export per-task statistics to userspace Andrea Righi
2009-04-28  8:47 ` [PATCH v15 0/7] cgroup: io-throttle controller Andrea Righi

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=20090428145050.GB990@linux \
    --to=righi.andrea@gmail.com \
    --cc=agk@sourceware.org \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=baramsori72@gmail.com \
    --cc=chlunde@ping.uio.no \
    --cc=containers@lists.linux-foundation.org \
    --cc=dave@linux.vnet.ibm.com \
    --cc=dpshah@google.com \
    --cc=dradford@bluehost.com \
    --cc=eric.rannaud@gmail.com \
    --cc=fchecconi@gmail.com \
    --cc=fernando@oss.ntt.co.jp \
    --cc=guijianfeng@cn.fujitsu.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=m-ikeda@ds.jp.nec.com \
    --cc=matt@bluehost.com \
    --cc=menage@google.com \
    --cc=nauman@google.com \
    --cc=ngupta@google.com \
    --cc=paolo.valente@unimore.it \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=randy.dunlap@oracle.com \
    --cc=roberto@unbit.it \
    --cc=ryov@valinux.co.jp \
    --cc=s-uchida@ap.jp.nec.com \
    --cc=subrata@linux.vnet.ibm.com \
    --cc=taka@valinux.co.jp \
    --cc=tytso@mit.edu \
    --cc=yoshikawa.takuya@oss.ntt.co.jp \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.