Skip to contentSkip to conversation

blk-cgroup: Initialize ioc->cgroup_changed at ioc creation time

PATCH In review Vivek Goyal 2 participants 2 messages May 23, 2011 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 blk-cgroup: Initialize ioc->cgroup_changed at ioc creation time

If we don't explicitly initialize it to zero, CFQ might think that cgroup of ioc has changed and it generates lots of unnecessary calls to call_for_each_cic(changed_cgroup). Fix it.

cfq_get_io_context()
cfq_ioc_set_cgroup()
call_for_each_cic(ioc, changed_cgroup)

---
 block/blk-ioc.c |    3 +++
 1 file changed, 3 insertions(+)
block/blk-ioc.c +3 -0
Index: linux-2.6-block/block/blk-ioc.c
===================================================================
@@ -96,6 +96,9 @@ struct io_context *alloc_io_context(gfp_
 		INIT_RADIX_TREE(&ret->radix_root, GFP_ATOMIC | __GFP_HIGH);
 		INIT_HLIST_HEAD(&ret->cic_list);
 		ret->ioc_data = NULL;
+#if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE)
+		ret->cgroup_changed = 0;
+#endif
 	}
 
 	return ret;
#1 lore raw
Quoted 7 lines · Vivek Goyal

If we don't explicitly initialize it to zero, CFQ might think that cgroup of ioc has changed and it generates lots of unnecessary calls to call_for_each_cic(changed_cgroup). Fix it.

cfq_get_io_context()
cfq_ioc_set_cgroup()
call_for_each_cic(ioc, changed_cgroup)

Thanks Vivek, applied.

Signature · 1 line
Jens Axboe