[Devel] [PATCH RHEL7 COMMIT] ub/fs: account writeback io

Konstantin Khorenko khorenko at virtuozzo.com
Tue Jun 16 05:29:04 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.13
------>
commit 64796a5a4e559059485cbb0809430e5d96aaeda6
Author: Vladimir Davydov <vdavydov at parallels.com>
Date:   Tue Jun 16 16:29:04 2015 +0400

    ub/fs: account writeback io
    
    Patchset description:
    
    https://jira.sw.ru/browse/PSBM-34007
    
    Vladimir Davydov (7):
      ioprio: move IOPRIO_WHO_UBC handling out of rcu section
      ub: zap ub_{init,fini}_ioprio
      ub: export ub_get_{mem,blkio}_css
      ub: ressurrect ioprio_set IOPRIO_WHO_UBC
      ub: ressurrect iostat and ioprio reporting
      ub: account writeback io
      ub: do not include block/blk-cgroup.h from io_prio.c
    
    This patch description:
    
    This patch ports hunks left from the following RH6 commits:
    
    diff-ubc-inode-wb-set-exec-to-dirtier
    diff-ubc-iostat-acct-writeback-io
    diff-ubc-iostat-acct-wb-at-req-insert
    
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
    Acked-by: Dmitry Monakhov <dmonakhov at openvz.org>
---
 block/cfq-iosched.c | 10 ++++++++++
 fs/fs-writeback.c   | 19 ++++++++++++++++++-
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index faf5cdd..5d8d665 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -2408,6 +2408,11 @@ static void cfq_bio_merged(struct request_queue *q, struct request *req,
 				struct bio *bio)
 {
 	cfqg_stats_update_io_merged(RQ_CFQG(req), bio->bi_rw);
+#ifdef CONFIG_BC_IO_PRIORITY
+	if (get_exec_ub()->ub_bound_css[UB_BLKIO_CGROUP] !=
+	    &(RQ_CFQG(req))->pd.blkg->blkcg->css)
+		ub_writeback_io(0, bio_sectors(bio));
+#endif
 }
 
 static void
@@ -3987,6 +3992,11 @@ static void cfq_insert_request(struct request_queue *q, struct request *rq)
 	cfqg_stats_update_io_add(RQ_CFQG(rq), cfqd->serving_group,
 				 rq->cmd_flags);
 
+#ifdef CONFIG_BC_IO_PRIORITY
+	if (get_exec_ub()->ub_bound_css[UB_BLKIO_CGROUP] !=
+	    &(RQ_CFQG(rq))->pd.blkg->blkcg->css)
+		ub_writeback_io(1, blk_rq_sectors(rq));
+#endif
 	virtinfo_notifier_call_irq(VITYPE_IO, VIRTINFO_IO_OP_ACCOUNT, q);
 	cfq_rq_enqueued(cfqd, cfqq, rq);
 }
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 8161c40..8362cc9 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -440,7 +440,7 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb,
  * setting I_SYNC flag and calling inode_sync_complete() to clear it.
  */
 static int
-__writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
+__do_writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
 {
 	struct address_space *mapping = inode->i_mapping;
 	long nr_to_write = wbc->nr_to_write;
@@ -488,6 +488,23 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
 	return ret;
 }
 
+static int
+__writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
+{
+	struct user_beancounter *ub = inode->i_mapping->dirtied_ub;
+	int ret;
+
+	if (likely(get_exec_ub() == ub || !ub))
+		return __do_writeback_single_inode(inode, wbc);
+
+	ub = get_beancounter_rcu(ub) ? set_exec_ub(ub) : NULL;
+	ret = __do_writeback_single_inode(inode, wbc);
+	if (ub)
+		put_beancounter(set_exec_ub(ub));
+
+	return ret;
+}
+
 /*
  * Write out an inode's dirty pages. Either the caller has an active reference
  * on the inode or the inode has I_WILL_FREE set.



More information about the Devel mailing list