aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup.h
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2012-03-08 13:53:56 -0500
committerJens Axboe <axboe@kernel.dk>2012-03-20 07:45:37 -0400
commit1cd9e039fc258f91fe38b97b3c622b13a3b8a795 (patch)
tree908f9747124b24ea4413025ab9294bd7d026b4f8 /block/blk-cgroup.h
parent671058fb2a2aac4e70f01b316b06bc59b98bd138 (diff)
blkcg: alloc per cpu stats from worker thread in a delayed manner
Current per cpu stat allocation assumes GFP_KERNEL allocation flag. But in IO path there are times when we want GFP_NOIO semantics. As there is no way to pass the allocation flags to alloc_percpu(), this patch delays the allocation of stats using a worker thread. v2-> tejun suggested following changes. Changed the patch accordingly. - move alloc_node location in structure - reduce the size of names of some of the fields - Reduce the scope of locking of alloc_list_lock - Simplified stat_alloc_fn() by allocating stats for all policies in one go and then assigning these to a group. v3 -> Andrew suggested to put some comments in the code. Also raised concerns about trying to allocate infinitely in case of allocation failure. I have changed the logic to sleep for 10ms before retrying. That should take care of non-preemptible UP kernels. v4 -> Tejun had more suggestions. - drop list_for_each_entry_all() - instead of msleep() use queue_delayed_work() - Some cleanups realted to more compact coding. v5-> tejun suggested more cleanups leading to more compact code. tj: - Relocated pcpu_stats into blkio_stat_alloc_fn(). - Minor comment update. - This also fixes suspicious RCU usage warning caused by invoking cgroup_path() from blkg_alloc() without holding RCU read lock. Now that blkg_alloc() doesn't require sleepable context, RCU read lock from blkg_lookup_create() is maintained throughout blkg_alloc(). Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-cgroup.h')
-rw-r--r--block/blk-cgroup.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/block/blk-cgroup.h b/block/blk-cgroup.h
index 98cd8533378f..1de32fe0e2af 100644
--- a/block/blk-cgroup.h
+++ b/block/blk-cgroup.h
@@ -190,6 +190,8 @@ struct blkio_group {
190 spinlock_t stats_lock; 190 spinlock_t stats_lock;
191 struct blkg_policy_data *pd[BLKIO_NR_POLICIES]; 191 struct blkg_policy_data *pd[BLKIO_NR_POLICIES];
192 192
193 /* List of blkg waiting for per cpu stats memory to be allocated */
194 struct list_head alloc_node;
193 struct rcu_head rcu_head; 195 struct rcu_head rcu_head;
194}; 196};
195 197