lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090428145050.GB990@linux>
Date:	Tue, 28 Apr 2009 16:50:50 +0200
From:	Andrea Righi <righi.andrea@...il.com>
To:	Paul Menage <menage@...gle.com>
Cc:	Balbir Singh <balbir@...ux.vnet.ibm.com>,
	Gui Jianfeng <guijianfeng@...fujitsu.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	agk@...rceware.org, akpm@...ux-foundation.org, axboe@...nel.dk,
	tytso@....edu, baramsori72@...il.com,
	Carl Henrik Lunde <chlunde@...g.uio.no>,
	dave@...ux.vnet.ibm.com, Divyesh Shah <dpshah@...gle.com>,
	eric.rannaud@...il.com, fernando@....ntt.co.jp,
	Hirokazu Takahashi <taka@...inux.co.jp>,
	Li Zefan <lizf@...fujitsu.com>, matt@...ehost.com,
	dradford@...ehost.com, ngupta@...gle.com, randy.dunlap@...cle.com,
	roberto@...it.it, Ryo Tsuruta <ryov@...inux.co.jp>,
	Satoshi UCHIDA <s-uchida@...jp.nec.com>,
	subrata@...ux.vnet.ibm.com, yoshikawa.takuya@....ntt.co.jp,
	Nauman Rafique <nauman@...gle.com>, fchecconi@...il.com,
	paolo.valente@...more.it, m-ikeda@...jp.nec.com,
	paulmck@...ux.vnet.ibm.com, containers@...ts.linux-foundation.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v15 4/7] io-throttle controller infrastructure

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@...il.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 */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ