From: Andrea Righi <arighi@develer.com>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>,
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Greg Thelen <gthelen@google.com>,
Wu Fengguang <fengguang.wu@intel.com>,
Gui Jianfeng <guijianfeng@cn.fujitsu.com>,
Ryo Tsuruta <ryov@valinux.co.jp>,
Hirokazu Takahashi <taka@valinux.co.jp>,
Jens Axboe <axboe@kernel.dk>, Jonathan Corbet <corbet@lwn.net>,
Andrew Morton <akpm@linux-foundation.org>,
containers@lists.linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Andrea Righi <arighi@develer.com>
Subject: [PATCH 3/3] blkio-throttle: async write io instrumentation
Date: Mon, 28 Feb 2011 11:15:05 +0100 [thread overview]
Message-ID: <1298888105-3778-4-git-send-email-arighi@develer.com> (raw)
In-Reply-To: <1298888105-3778-1-git-send-email-arighi@develer.com>
Enforce IO throttling policy to asynchronous IO writes at the time tasks
write pages in the page cache.
Signed-off-by: Andrea Righi <arighi@develer.com>
---
mm/page-writeback.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 2cb01f6..e3f5f4f 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -607,6 +607,19 @@ void set_page_dirty_balance(struct page *page, int page_mkwrite)
}
}
+/*
+ * Get a request_queue of the underlying superblock device from an
+ * address_space.
+ */
+static struct request_queue *as_to_rq(struct address_space *mapping)
+{
+ struct block_device *bdev;
+
+ bdev = (mapping->host && mapping->host->i_sb->s_bdev) ?
+ mapping->host->i_sb->s_bdev : NULL;
+ return bdev ? bdev_get_queue(bdev) : NULL;
+}
+
static DEFINE_PER_CPU(unsigned long, bdp_ratelimits) = 0;
/**
@@ -628,6 +641,7 @@ void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
{
unsigned long ratelimit;
unsigned long *p;
+ struct request_queue *q;
ratelimit = ratelimit_pages;
if (mapping->backing_dev_info->dirty_exceeded)
@@ -644,6 +658,9 @@ void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
ratelimit = sync_writeback_pages(*p);
*p = 0;
preempt_enable();
+ q = as_to_rq(mapping);
+ if (q)
+ blk_throtl_async(q, ratelimit << PAGE_SHIFT);
balance_dirty_pages(mapping, ratelimit);
return;
}
--
1.7.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-02-28 10:17 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-28 10:15 [PATCH 0/3] blk-throttle: async write throttling Andrea Righi
2011-02-28 10:15 ` [PATCH 1/3] block: introduce REQ_DIRECT to track direct io bio Andrea Righi
2011-02-28 10:15 ` [PATCH 2/3] blkio-throttle: infrastructure to throttle async io Andrea Righi
2011-03-01 16:06 ` Vivek Goyal
2011-03-02 13:31 ` Andrea Righi
2011-02-28 10:15 ` Andrea Righi [this message]
2011-02-28 23:01 ` [PATCH 0/3] blk-throttle: async write throttling Vivek Goyal
2011-03-02 13:28 ` Andrea Righi
2011-03-02 21:47 ` Vivek Goyal
2011-03-06 15:52 ` Andrea Righi
2011-03-07 7:31 ` Gui Jianfeng
2011-03-07 11:34 ` Andrea Righi
2011-03-07 11:44 ` Gui Jianfeng
2011-03-07 11:59 ` Andrea Righi
2011-03-07 12:15 ` Gui Jianfeng
2011-03-07 15:22 ` Vivek Goyal
2011-03-02 22:00 ` Greg Thelen
2011-03-01 16:27 ` Vivek Goyal
2011-03-01 21:40 ` 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=1298888105-3778-4-git-send-email-arighi@develer.com \
--to=arighi@develer.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=balbir@linux.vnet.ibm.com \
--cc=containers@lists.linux-foundation.org \
--cc=corbet@lwn.net \
--cc=fengguang.wu@intel.com \
--cc=gthelen@google.com \
--cc=guijianfeng@cn.fujitsu.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nishimura@mxp.nes.nec.co.jp \
--cc=ryov@valinux.co.jp \
--cc=taka@valinux.co.jp \
--cc=vgoyal@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;
as well as URLs for NNTP newsgroup(s).