linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Tan Hu <tan.hu@zte.com.cn>
Cc: zhong.weidong@zte.com.cn, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] proc: only export statistics of softirqs for online cpus
Date: Sat, 12 Jan 2019 02:03:43 +0300	[thread overview]
Message-ID: <20190111230343.GA20267@avx2> (raw)
In-Reply-To: <1547119441-28314-1-git-send-email-tan.hu@zte.com.cn>

On Thu, Jan 10, 2019 at 07:24:01PM +0800, Tan Hu wrote:
> @@ -12,13 +12,13 @@ static int show_softirqs(struct seq_file *p, void *v)
>  	int i, j;
>  
>  	seq_puts(p, "                    ");
> -	for_each_possible_cpu(i)
> +	for_each_online_cpu(i)
>  		seq_printf(p, "CPU%-8d", i);
>  	seq_putc(p, '\n');
>  
>  	for (i = 0; i < NR_SOFTIRQS; i++) {
>  		seq_printf(p, "%12s:", softirq_to_name[i]);
> -		for_each_possible_cpu(j)
> +		for_each_online_cpu(j)
>  			seq_printf(p, " %10u", kstat_softirqs_cpu(i, j));
>  		seq_putc(p, '\n');
>  	}

This should break userspace:

	https://sources.debian.org/src/netsniff-ng/0.6.5-1/ifpps.c/#L330

This code gets the number of "possible" CPUs from sysconf(3) and doesn't
parse header to find out which CPUs are online.

  parent reply	other threads:[~2019-01-11 23:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-10 11:24 [PATCH] proc: only export statistics of softirqs for online cpus Tan Hu
2019-01-10 11:24 ` Tan Hu
2019-01-11 23:03 ` Alexey Dobriyan [this message]
2019-01-11 23:03   ` Alexey Dobriyan

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=20190111230343.GA20267@avx2 \
    --to=adobriyan@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tan.hu@zte.com.cn \
    --cc=zhong.weidong@zte.com.cn \
    /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;
as well as URLs for NNTP newsgroup(s).