Signed-off-by: Wu Fengguang --- block/blk-cgroup.c | 4 ++++ include/linux/blk-cgroup.h | 1 + mm/page-writeback.c | 6 ++++++ 3 files changed, 11 insertions(+) --- linux-next.orig/block/blk-cgroup.c 2012-03-28 14:55:47.522142976 +0800 +++ linux-next/block/blk-cgroup.c 2012-03-28 15:39:46.722088815 +0800 @@ -1594,6 +1594,7 @@ static void blkiocg_destroy(struct cgrou free_css_id(&blkio_subsys, &blkcg->css); rcu_read_unlock(); + percpu_counter_destroy(&blkcg->nr_dirtied); if (blkcg != &blkio_root_cgroup) kfree(blkcg); } @@ -1619,6 +1620,9 @@ done: INIT_HLIST_HEAD(&blkcg->blkg_list); INIT_LIST_HEAD(&blkcg->policy_list); + + percpu_counter_init(&blkcg->nr_dirtied, 0); + return &blkcg->css; } --- linux-next.orig/include/linux/blk-cgroup.h 2012-03-28 14:55:47.530142977 +0800 +++ linux-next/include/linux/blk-cgroup.h 2012-03-28 15:40:27.754087973 +0800 @@ -117,6 +117,7 @@ struct blkio_cgroup { spinlock_t lock; struct hlist_head blkg_list; struct list_head policy_list; /* list of blkio_policy_node */ + struct percpu_counter nr_dirtied; }; struct blkio_group_stats { --- linux-next.orig/mm/page-writeback.c 2012-03-28 14:55:47.510142976 +0800 +++ linux-next/mm/page-writeback.c 2012-03-28 15:40:39.366087735 +0800 @@ -34,6 +34,7 @@ #include #include /* __set_page_dirty_buffers */ #include +#include #include /* @@ -1933,6 +1934,11 @@ int __set_page_dirty_no_writeback(struct void account_page_dirtied(struct page *page, struct address_space *mapping) { if (mapping_cap_account_dirty(mapping)) { +#ifdef CONFIG_BLK_DEV_THROTTLING + struct blkio_cgroup *blkcg = task_blkio_cgroup(current); + if (blkcg) + __percpu_counter_add(&blkcg->nr_dirtied, 1, BDI_STAT_BATCH); +#endif __inc_zone_page_state(page, NR_FILE_DIRTY); __inc_zone_page_state(page, NR_DIRTIED); __inc_bdi_stat(mapping->backing_dev_info, BDI_RECLAIMABLE); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/