* [PATCH] proc: only export statistics of softirqs for online cpus
@ 2019-01-10 11:24 Tan Hu
2019-01-10 11:24 ` Tan Hu
2019-01-11 23:03 ` Alexey Dobriyan
0 siblings, 2 replies; 4+ messages in thread
From: Tan Hu @ 2019-01-10 11:24 UTC (permalink / raw)
To: adobriyan; +Cc: zhong.weidong, linux-kernel, linux-fsdevel
Only export statistics of softirqs for online cpus like
/proc/interrupts, it would be more clearly.
Signed-off-by: Tan Hu <tan.hu@zte.com.cn>
---
fs/proc/softirqs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/proc/softirqs.c b/fs/proc/softirqs.c
index 12901dc..b7e6a0f 100644
--- a/fs/proc/softirqs.c
+++ b/fs/proc/softirqs.c
@@ -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');
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] proc: only export statistics of softirqs for online cpus
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
1 sibling, 0 replies; 4+ messages in thread
From: Tan Hu @ 2019-01-10 11:24 UTC (permalink / raw)
To: adobriyan; +Cc: zhong.weidong, linux-kernel, linux-fsdevel
Only export statistics of softirqs for online cpus like
/proc/interrupts, it would be more clearly.
Signed-off-by: Tan Hu <tan.hu@zte.com.cn>
---
fs/proc/softirqs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/proc/softirqs.c b/fs/proc/softirqs.c
index 12901dc..b7e6a0f 100644
--- a/fs/proc/softirqs.c
+++ b/fs/proc/softirqs.c
@@ -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');
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] proc: only export statistics of softirqs for online cpus
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
2019-01-11 23:03 ` Alexey Dobriyan
1 sibling, 1 reply; 4+ messages in thread
From: Alexey Dobriyan @ 2019-01-11 23:03 UTC (permalink / raw)
To: Tan Hu; +Cc: zhong.weidong, linux-kernel, linux-fsdevel
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] proc: only export statistics of softirqs for online cpus
2019-01-11 23:03 ` Alexey Dobriyan
@ 2019-01-11 23:03 ` Alexey Dobriyan
0 siblings, 0 replies; 4+ messages in thread
From: Alexey Dobriyan @ 2019-01-11 23:03 UTC (permalink / raw)
To: Tan Hu; +Cc: zhong.weidong, linux-kernel, linux-fsdevel
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-01-11 23:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2019-01-11 23:03 ` Alexey Dobriyan
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).