From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tejun Heo Subject: Re: [PATCH] cgroups: Do not show inactive devices in cgroups statistics Date: Wed, 26 Jun 2013 13:45:40 -0700 Message-ID: <20130626204540.GA4536@htj.dyndns.org> References: <1372274770-30679-1-git-send-email-anatol.pomozov@gmail.com> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=lt8Tp1ebTKINDP1FV2IRAmDgCxhK5y/EpvSDBxadlEM=; b=ODlwu1fS/08YgNU3lYmNHrY+laGOyVsgS1ry/5kbXhwPaZ3lWuMpySgb3xtntUE8k9 I21vL7OwDAMiG5v1fdZ3a5tO+xiaGeioYUcLqMSKHQVctkd2EpNtgWWXmCKLhs8S/lyA q9qRBvbVt9kXELFDDmXYe7oUy8sZHFCcGzGtp0XSThiHSgrFHSeafDWS88xGcDa/0nVJ lD4XWos1HLsY2xT73lqqNNLxs0/itnZbcE3xT/Gzd+u1WLUXfVBpS1XMoNGXYGe5R34L Eqci5/Cpk9/nwqTm/KVvcxlEmNK9O2hBbrz9mQgOgWzjzS1D1KkG4Or/YxKORlbzdhOz mupg== Content-Disposition: inline In-Reply-To: <1372274770-30679-1-git-send-email-anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Anatol Pomozov Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Vivek Goyal , Jens Axboe (cc'ing Vivek and Jens) On Wed, Jun 26, 2013 at 12:26:10PM -0700, Anatol Pomozov wrote: > @@ -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; > + I don't think it'd be a good idea to filter out 0 by default from __blkg_prfill_u64(). It'd probably be a better idea to do the filtering from the users of __blkg_prfill_u64(). Would that be a lot more churn? > @@ -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; > + Doing it from rwstat is fine as it's always printing "stats" and suppressing 0 stats by default should be fine, I think. Can you please update the function comment accordingly tho? Vivek, any objections? Thanks. -- tejun