The patch titled proc: remove redundunt for_each_possible_cpu() loop has been removed from the -mm tree. Its filename was proc-export-statistics-for-softirq-to-proc-fix.patch This patch was dropped because it was folded into proc-export-statistics-for-softirq-to-proc.patch The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: proc: remove redundunt for_each_possible_cpu() loop From: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx> Distros will set NR_CPUS to very large number and at that time for_each_possible_cpu() is a bit costly. Therefore, To remove unnecessary twice loop is better. Note. we can remove softirq's redundunt loop, but we can't remove irq's. because NR_SOFTIRQS ~= 10, NR_IRQS ~= 4000 (in x86 case). Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx> Cc: Keika Kobayashi <kobayashi.kk@xxxxxxxxxxxxxx> Cc: Hiroshi Shimamoto <h-shimamoto@xxxxxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxx> Cc: Eric Dumazet <dada1@xxxxxxxxxxxxx> Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/proc/stat.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff -puN fs/proc/stat.c~proc-export-statistics-for-softirq-to-proc-fix fs/proc/stat.c --- a/fs/proc/stat.c~proc-export-statistics-for-softirq-to-proc-fix +++ a/fs/proc/stat.c @@ -27,6 +27,7 @@ static int show_stat(struct seq_file *p, cputime64_t guest; u64 sum = 0; u64 sum_softirq = 0; + unsigned int per_softirq_sums[NR_SOFTIRQS] = {0}; struct timespec boottime; unsigned int per_irq_sum; @@ -51,8 +52,12 @@ static int show_stat(struct seq_file *p, } sum += arch_irq_stat_cpu(i); - for (j = 0; j < NR_SOFTIRQS; j++) - sum_softirq += kstat_softirqs_cpu(j, i); + for (j = 0; j < NR_SOFTIRQS; j++) { + unsigned int softirq_stat = kstat_softirqs_cpu(j, i); + + per_softirq_sums[j] += softirq_stat; + sum_softirq += softirq_stat; + } } sum += arch_irq_stat(); @@ -118,12 +123,7 @@ static int show_stat(struct seq_file *p, seq_printf(p, "softirq %llu", (unsigned long long)sum_softirq); for (i = 0; i < NR_SOFTIRQS; i++) { - per_irq_sum = 0; - - for_each_possible_cpu(j) - per_irq_sum += kstat_softirqs_cpu(i, j); - - seq_printf(p, " %u", per_irq_sum); + seq_printf(p, " %u", per_softirq_sums[i]); } seq_printf(p, "\n"); _ Patches currently in -mm which might be from kosaki.motohiro@xxxxxxxxxxxxxx are origin.patch linux-next.patch mm-update_page_reclaim_stat-is-called-from-page-fault-path.patch getrusage-fill-ru_maxrss-value.patch softirq-introduce-statistics-for-softirq.patch proc-export-statistics-for-softirq-to-proc.patch proc-export-statistics-for-softirq-to-proc-fix.patch proc-update-document-for-proc-softirqs-and-proc-stat.patch memcg-remove-mem_cgroup_calc_mapped_ratio-take2.patch memcg-remove-mem_cgroup_reclaim_imbalance-remnants.patch ia64-implement-interrupt-enabling-rwlocks.patch fs-symlink-write_begin-allocation-context-fix-reiser4-fix.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html