* [PATCH 12/13] riscv/irq: use seq_put_decimal_ull_width() for decimal values @ 2024-11-08 16:25 David Wang 2025-01-28 1:16 ` Charlie Jenkins 2025-02-25 15:10 ` Alexandre Ghiti 0 siblings, 2 replies; 4+ messages in thread From: David Wang @ 2024-11-08 16:25 UTC (permalink / raw) To: paul.walmsley, palmer, aou; +Cc: linux-kernel, linux-riscv, David Wang Performance improvement for reading /proc/interrupts on arch riscv Signed-off-by: David Wang <00107082@163.com> --- arch/riscv/kernel/smp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c index c180a647a30e..f1e9c3db094c 100644 --- a/arch/riscv/kernel/smp.c +++ b/arch/riscv/kernel/smp.c @@ -226,7 +226,8 @@ void show_ipi_stats(struct seq_file *p, int prec) seq_printf(p, "%*s%u:%s", prec - 1, "IPI", i, prec >= 4 ? " " : ""); for_each_online_cpu(cpu) - seq_printf(p, "%10u ", irq_desc_kstat_cpu(ipi_desc[i], cpu)); + seq_put_decimal_ull_width(p, " ", + irq_desc_kstat_cpu(ipi_desc[i], cpu), 10); seq_printf(p, " %s\n", ipi_names[i]); } } -- 2.39.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 12/13] riscv/irq: use seq_put_decimal_ull_width() for decimal values 2024-11-08 16:25 [PATCH 12/13] riscv/irq: use seq_put_decimal_ull_width() for decimal values David Wang @ 2025-01-28 1:16 ` Charlie Jenkins 2025-02-25 15:10 ` Alexandre Ghiti 1 sibling, 0 replies; 4+ messages in thread From: Charlie Jenkins @ 2025-01-28 1:16 UTC (permalink / raw) To: David Wang; +Cc: paul.walmsley, palmer, aou, linux-kernel, linux-riscv On Sat, Nov 09, 2024 at 12:25:03AM +0800, David Wang wrote: > Performance improvement for reading /proc/interrupts on arch riscv > > Signed-off-by: David Wang <00107082@163.com> Reviewed-by: Charlie Jenkins <charlie@rivosinc.com> Tested-by: Charlie Jenkins <charlie@rivosinc.com> > --- > arch/riscv/kernel/smp.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c > index c180a647a30e..f1e9c3db094c 100644 > --- a/arch/riscv/kernel/smp.c > +++ b/arch/riscv/kernel/smp.c > @@ -226,7 +226,8 @@ void show_ipi_stats(struct seq_file *p, int prec) > seq_printf(p, "%*s%u:%s", prec - 1, "IPI", i, > prec >= 4 ? " " : ""); > for_each_online_cpu(cpu) > - seq_printf(p, "%10u ", irq_desc_kstat_cpu(ipi_desc[i], cpu)); > + seq_put_decimal_ull_width(p, " ", > + irq_desc_kstat_cpu(ipi_desc[i], cpu), 10); > seq_printf(p, " %s\n", ipi_names[i]); > } > } > -- > 2.39.2 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 12/13] riscv/irq: use seq_put_decimal_ull_width() for decimal values 2024-11-08 16:25 [PATCH 12/13] riscv/irq: use seq_put_decimal_ull_width() for decimal values David Wang 2025-01-28 1:16 ` Charlie Jenkins @ 2025-02-25 15:10 ` Alexandre Ghiti 2025-02-26 3:45 ` David Wang 1 sibling, 1 reply; 4+ messages in thread From: Alexandre Ghiti @ 2025-02-25 15:10 UTC (permalink / raw) To: David Wang, paul.walmsley, palmer, aou; +Cc: linux-kernel, linux-riscv Hi David, On 08/11/2024 17:25, David Wang wrote: > Performance improvement for reading /proc/interrupts on arch riscv > > Signed-off-by: David Wang <00107082@163.com> > --- > arch/riscv/kernel/smp.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c > index c180a647a30e..f1e9c3db094c 100644 > --- a/arch/riscv/kernel/smp.c > +++ b/arch/riscv/kernel/smp.c > @@ -226,7 +226,8 @@ void show_ipi_stats(struct seq_file *p, int prec) > seq_printf(p, "%*s%u:%s", prec - 1, "IPI", i, > prec >= 4 ? " " : ""); > for_each_online_cpu(cpu) > - seq_printf(p, "%10u ", irq_desc_kstat_cpu(ipi_desc[i], cpu)); > + seq_put_decimal_ull_width(p, " ", > + irq_desc_kstat_cpu(ipi_desc[i], cpu), 10); > seq_printf(p, " %s\n", ipi_names[i]); > } > } Very late answer sorry! I don't have the same output before and after your patch because seq_put_decimal_ull_width() second argument is placed *before* the number, not after as it was before. The following diff fixes the issue: diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c index f1e9c3db094c3..4b80ee4e5b2c0 100644 --- a/arch/riscv/kernel/smp.c +++ b/arch/riscv/kernel/smp.c @@ -225,9 +225,11 @@ void show_ipi_stats(struct seq_file *p, int prec) for (i = 0; i < IPI_MAX; i++) { seq_printf(p, "%*s%u:%s", prec - 1, "IPI", i, prec >= 4 ? " " : ""); - for_each_online_cpu(cpu) - seq_put_decimal_ull_width(p, " ", + for_each_online_cpu(cpu) { + seq_put_decimal_ull_width(p, NULL, irq_desc_kstat_cpu(ipi_desc[i], cpu), 10); + seq_putc(p, ' '); + } seq_printf(p, " %s\n", ipi_names[i]); } } Will you respin a new version? Thanks, Alex ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 12/13] riscv/irq: use seq_put_decimal_ull_width() for decimal values 2025-02-25 15:10 ` Alexandre Ghiti @ 2025-02-26 3:45 ` David Wang 0 siblings, 0 replies; 4+ messages in thread From: David Wang @ 2025-02-26 3:45 UTC (permalink / raw) To: Alexandre Ghiti; +Cc: paul.walmsley, palmer, aou, linux-kernel, linux-riscv Hi, Thanks for the test and review, and sorry for not giving more attentions to alignment issues when made the patch. But if alignment should not be changed, simply appending a [space] is not enough: the patch change '%10u[space]" to "[space]%10u", one [space] is moved from tail to the front, and to restore to its original state , one [space] should be removed from front. and It would make the code ugly and unpleasant to remove a [space] from this line seq_printf(p, "%*s%u:%s", prec - 1, "IPI", i, prec >= 4 ? " " : ""); ( or make changes to seq_put_decimal_ull_width) Kind of think that it does not worth the effort if code changes are way too unpleasant.... Thanks David At 2025-02-25 23:10:26, "Alexandre Ghiti" <alex@ghiti.fr> wrote: >Hi David, > >On 08/11/2024 17:25, David Wang wrote: >> Performance improvement for reading /proc/interrupts on arch riscv >> >> Signed-off-by: David Wang <00107082@163.com> >> --- >> arch/riscv/kernel/smp.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c >> index c180a647a30e..f1e9c3db094c 100644 >> --- a/arch/riscv/kernel/smp.c >> +++ b/arch/riscv/kernel/smp.c >> @@ -226,7 +226,8 @@ void show_ipi_stats(struct seq_file *p, int prec) >> seq_printf(p, "%*s%u:%s", prec - 1, "IPI", i, >> prec >= 4 ? " " : ""); >> for_each_online_cpu(cpu) >> - seq_printf(p, "%10u ", irq_desc_kstat_cpu(ipi_desc[i], cpu)); >> + seq_put_decimal_ull_width(p, " ", >> + irq_desc_kstat_cpu(ipi_desc[i], cpu), 10); >> seq_printf(p, " %s\n", ipi_names[i]); >> } >> } > > >Very late answer sorry! > >I don't have the same output before and after your patch because >seq_put_decimal_ull_width() second argument is placed *before* the >number, not after as it was before. > >The following diff fixes the issue: > >diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c index >f1e9c3db094c3..4b80ee4e5b2c0 100644 --- a/arch/riscv/kernel/smp.c +++ >b/arch/riscv/kernel/smp.c @@ -225,9 +225,11 @@ void >show_ipi_stats(struct seq_file *p, int prec) for (i = 0; i < IPI_MAX; >i++) { seq_printf(p, "%*s%u:%s", prec - 1, "IPI", i, prec >= 4 ? " " : >""); - for_each_online_cpu(cpu) - seq_put_decimal_ull_width(p, " ", + >for_each_online_cpu(cpu) { + seq_put_decimal_ull_width(p, NULL, >irq_desc_kstat_cpu(ipi_desc[i], cpu), 10); + seq_putc(p, ' '); + } >seq_printf(p, " %s\n", ipi_names[i]); } } > >Will you respin a new version? > >Thanks, > >Alex ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-02-26 3:45 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-11-08 16:25 [PATCH 12/13] riscv/irq: use seq_put_decimal_ull_width() for decimal values David Wang 2025-01-28 1:16 ` Charlie Jenkins 2025-02-25 15:10 ` Alexandre Ghiti 2025-02-26 3:45 ` David Wang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox