public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cgroups: Do not show inactive devices in cgroups statistics
@ 2013-06-26 19:26 Anatol Pomozov
       [not found] ` <1372274770-30679-1-git-send-email-anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Anatol Pomozov @ 2013-06-26 19:26 UTC (permalink / raw)
  To: tj-DgEjT+Ai2ygdnm+yROfE0A; +Cc: cgroups-u79uwXL29TY76Z2rM5mHXA, Anatol Pomozov

Before 3.5 cgrups stats files shown only devices with activity.
But latest kernel shows stats for all devices. The previous implementation
looks better. Imagine a server machine with hundreds cgroups and hundreds
iSCSI block devices (where cgroup uses just a few block devices). This
generates *a lot* of useless data that requires more resources to
process/store.

Recover previous behaviour by skipping entries with zero stats.

Signed-off-by: Anatol Pomozov <anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 block/blk-cgroup.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index e8918ff..915c2b0 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -548,6 +548,9 @@ u64 __blkg_prfill_u64(struct seq_file *sf, struct blkg_policy_data *pd, u64 v)
 	if (!dname)
 		return 0;
 
+	if (!v)
+		return 0;
+
 	seq_printf(sf, "%s %llu\n", dname, (unsigned long long)v);
 	return v;
 }
@@ -571,19 +574,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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-06-27 17:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-26 19:26 [PATCH] cgroups: Do not show inactive devices in cgroups statistics Anatol Pomozov
     [not found] ` <1372274770-30679-1-git-send-email-anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-06-26 19:36   ` Anatol Pomozov
2013-06-26 20:45   ` Tejun Heo
     [not found]     ` <20130626204540.GA4536-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2013-06-26 21:08       ` Vivek Goyal
     [not found]         ` <20130626210820.GA17564-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-06-26 21:11           ` Tejun Heo
     [not found]             ` <CAOS58YP_Umud2DTY+3tc4m02FywGNOEALSN1An4OLXczcmsQ4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-06-27  0:37               ` Anatol Pomozov
     [not found]                 ` <CAOMFOmVqevNSKgWR5keT8u7vsCRpHhYROejM6OucyNeeA6j6zQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-06-27  1:23                   ` Tejun Heo
     [not found]                     ` <20130627012304.GG4536-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2013-06-27  1:23                       ` Tejun Heo
2013-06-27 16:37                       ` Anatol Pomozov
     [not found]                         ` <1372351046-11976-1-git-send-email-anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-06-27 16:59                           ` Tejun Heo
     [not found]                             ` <20130627165943.GA5599-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2013-06-27 17:21                               ` Anatol Pomozov
2013-06-27 16:39                       ` Anatol Pomozov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox