Skip to content

Commit 5b881c1

Browse files
zq-david-wangmpe
authored andcommitted
powerpc/irq: use seq_put_decimal_ull_width() for decimal values
On a system with n CPUs and m interrupts, there will be n*m decimal values yielded via seq_printf(.."%10u "..) which is less efficient than seq_put_decimal_ull_width(), stress reading /proc/interrupts indicates ~30% performance improvement with this patch. Signed-off-by: David Wang <00107082@163.com> [mpe: Flesh out change log based on original submission] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/all/20241103080552.4787-1-00107082@163.com Link: https://patch.msgid.link/20241108162327.9887-1-00107082@163.com
1 parent 44e5d21 commit 5b881c1

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

arch/powerpc/kernel/irq.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -89,69 +89,69 @@ int arch_show_interrupts(struct seq_file *p, int prec)
8989

9090
#if defined(CONFIG_PPC32) && defined(CONFIG_TAU_INT)
9191
if (tau_initialized) {
92-
seq_printf(p, "%*s: ", prec, "TAU");
92+
seq_printf(p, "%*s:", prec, "TAU");
9393
for_each_online_cpu(j)
94-
seq_printf(p, "%10u ", tau_interrupts(j));
94+
seq_put_decimal_ull_width(p, " ", tau_interrupts(j), 10);
9595
seq_puts(p, " PowerPC Thermal Assist (cpu temp)\n");
9696
}
9797
#endif /* CONFIG_PPC32 && CONFIG_TAU_INT */
9898

99-
seq_printf(p, "%*s: ", prec, "LOC");
99+
seq_printf(p, "%*s:", prec, "LOC");
100100
for_each_online_cpu(j)
101-
seq_printf(p, "%10u ", per_cpu(irq_stat, j).timer_irqs_event);
101+
seq_put_decimal_ull_width(p, " ", per_cpu(irq_stat, j).timer_irqs_event, 10);
102102
seq_printf(p, " Local timer interrupts for timer event device\n");
103103

104-
seq_printf(p, "%*s: ", prec, "BCT");
104+
seq_printf(p, "%*s:", prec, "BCT");
105105
for_each_online_cpu(j)
106-
seq_printf(p, "%10u ", per_cpu(irq_stat, j).broadcast_irqs_event);
106+
seq_put_decimal_ull_width(p, " ", per_cpu(irq_stat, j).broadcast_irqs_event, 10);
107107
seq_printf(p, " Broadcast timer interrupts for timer event device\n");
108108

109-
seq_printf(p, "%*s: ", prec, "LOC");
109+
seq_printf(p, "%*s:", prec, "LOC");
110110
for_each_online_cpu(j)
111-
seq_printf(p, "%10u ", per_cpu(irq_stat, j).timer_irqs_others);
111+
seq_put_decimal_ull_width(p, " ", per_cpu(irq_stat, j).timer_irqs_others, 10);
112112
seq_printf(p, " Local timer interrupts for others\n");
113113

114-
seq_printf(p, "%*s: ", prec, "SPU");
114+
seq_printf(p, "%*s:", prec, "SPU");
115115
for_each_online_cpu(j)
116-
seq_printf(p, "%10u ", per_cpu(irq_stat, j).spurious_irqs);
116+
seq_put_decimal_ull_width(p, " ", per_cpu(irq_stat, j).spurious_irqs, 10);
117117
seq_printf(p, " Spurious interrupts\n");
118118

119-
seq_printf(p, "%*s: ", prec, "PMI");
119+
seq_printf(p, "%*s:", prec, "PMI");
120120
for_each_online_cpu(j)
121-
seq_printf(p, "%10u ", per_cpu(irq_stat, j).pmu_irqs);
121+
seq_put_decimal_ull_width(p, " ", per_cpu(irq_stat, j).pmu_irqs, 10);
122122
seq_printf(p, " Performance monitoring interrupts\n");
123123

124-
seq_printf(p, "%*s: ", prec, "MCE");
124+
seq_printf(p, "%*s:", prec, "MCE");
125125
for_each_online_cpu(j)
126-
seq_printf(p, "%10u ", per_cpu(irq_stat, j).mce_exceptions);
126+
seq_put_decimal_ull_width(p, " ", per_cpu(irq_stat, j).mce_exceptions, 10);
127127
seq_printf(p, " Machine check exceptions\n");
128128

129129
#ifdef CONFIG_PPC_BOOK3S_64
130130
if (cpu_has_feature(CPU_FTR_HVMODE)) {
131-
seq_printf(p, "%*s: ", prec, "HMI");
131+
seq_printf(p, "%*s:", prec, "HMI");
132132
for_each_online_cpu(j)
133-
seq_printf(p, "%10u ", paca_ptrs[j]->hmi_irqs);
133+
seq_put_decimal_ull_width(p, " ", paca_ptrs[j]->hmi_irqs, 10);
134134
seq_printf(p, " Hypervisor Maintenance Interrupts\n");
135135
}
136136
#endif
137137

138-
seq_printf(p, "%*s: ", prec, "NMI");
138+
seq_printf(p, "%*s:", prec, "NMI");
139139
for_each_online_cpu(j)
140-
seq_printf(p, "%10u ", per_cpu(irq_stat, j).sreset_irqs);
140+
seq_put_decimal_ull_width(p, " ", per_cpu(irq_stat, j).sreset_irqs, 10);
141141
seq_printf(p, " System Reset interrupts\n");
142142

143143
#ifdef CONFIG_PPC_WATCHDOG
144-
seq_printf(p, "%*s: ", prec, "WDG");
144+
seq_printf(p, "%*s:", prec, "WDG");
145145
for_each_online_cpu(j)
146-
seq_printf(p, "%10u ", per_cpu(irq_stat, j).soft_nmi_irqs);
146+
seq_put_decimal_ull_width(p, " ", per_cpu(irq_stat, j).soft_nmi_irqs, 10);
147147
seq_printf(p, " Watchdog soft-NMI interrupts\n");
148148
#endif
149149

150150
#ifdef CONFIG_PPC_DOORBELL
151151
if (cpu_has_feature(CPU_FTR_DBELL)) {
152-
seq_printf(p, "%*s: ", prec, "DBL");
152+
seq_printf(p, "%*s:", prec, "DBL");
153153
for_each_online_cpu(j)
154-
seq_printf(p, "%10u ", per_cpu(irq_stat, j).doorbell_irqs);
154+
seq_put_decimal_ull_width(p, " ", per_cpu(irq_stat, j).doorbell_irqs, 10);
155155
seq_printf(p, " Doorbell interrupts\n");
156156
}
157157
#endif

0 commit comments

Comments
 (0)