public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Anatol Pomozov <anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Jens Axboe <axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>
Subject: Re: [PATCH] cgroups: Do not show inactive devices in cgroups statistics
Date: Thu, 27 Jun 2013 09:59:43 -0700	[thread overview]
Message-ID: <20130627165943.GA5599@mtj.dyndns.org> (raw)
In-Reply-To: <1372351046-11976-1-git-send-email-anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

(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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Acked-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

> ---
>  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

  parent reply	other threads:[~2013-06-27 16:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
     [not found]                             ` <20130627165943.GA5599-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2013-06-27 17:21                               ` Anatol Pomozov
2013-06-27 16:39                       ` Anatol Pomozov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130627165943.GA5599@mtj.dyndns.org \
    --to=tj-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox