(cc'ing Jens) Hello, This one probably needs -stable cc'd. Jens, do you wanna take this? If not, I'll be happy to take it through cgroup tree. Thanks. On Thu, Jun 27, 2013 at 09:37:26AM -0700, Anatol Pomozov wrote: > Before 3.5 CFQ cgroups stats was lazy initialized - the stat object was created > only if the device had any I/O in that cgroup. > > Around 3.5 time CFQ stat structure became part of device structure. And > zero stat is created when device is initialized. Initialization can happen > e.g. when we configure it via 'weight_device' file. It calls > cfqg_set_weight_device() and it creates cfq_group structure. > > But even if device is initialized the stats is still zero. > If we configure all devices in all in all cgroups it generates a lot of > useless stat info that takes more resources to process and store. Imagine > servers with handreds cgroups and handreds iSCSI block devices. > > Do not print stats for inactive devices - it restores functionality > that was before 3.5 > > Signed-off-by: Anatol Pomozov <anatol.pomozov@xxxxxxxxx> Acked-by: Tejun Heo <tj@xxxxxxxxxx> > --- > block/blk-cgroup.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c > index e8918ff..4e07e73 100644 > --- a/block/blk-cgroup.c > +++ b/block/blk-cgroup.c > @@ -560,6 +560,7 @@ EXPORT_SYMBOL_GPL(__blkg_prfill_u64); > * @rwstat: rwstat to print > * > * Print @rwstat to @sf for the device assocaited with @pd. > + * Devices with zero activity will not be printed. > */ > u64 __blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, > const struct blkg_rwstat *rwstat) > @@ -571,19 +572,23 @@ u64 __blkg_prfill_rwstat(struct seq_file *sf, struct blkg_policy_data *pd, > [BLKG_RWSTAT_ASYNC] = "Async", > }; > const char *dname = blkg_dev_name(pd->blkg); > - u64 v; > + u64 total; > int i; > > if (!dname) > return 0; > > + total = rwstat->cnt[BLKG_RWSTAT_READ] + rwstat->cnt[BLKG_RWSTAT_WRITE]; > + /* skip devices with no activity */ > + if (!total) > + return 0; > + > for (i = 0; i < BLKG_RWSTAT_NR; i++) > seq_printf(sf, "%s %s %llu\n", dname, rwstr[i], > (unsigned long long)rwstat->cnt[i]); > > - v = rwstat->cnt[BLKG_RWSTAT_READ] + rwstat->cnt[BLKG_RWSTAT_WRITE]; > - seq_printf(sf, "%s Total %llu\n", dname, (unsigned long long)v); > - return v; > + seq_printf(sf, "%s Total %llu\n", dname, (unsigned long long)total); > + return total; > } > EXPORT_SYMBOL_GPL(__blkg_prfill_rwstat); > > -- > 1.8.3 > -- tejun -- To unsubscribe from this list: send the line "unsubscribe cgroups" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html