Re: [PATCH v2] proc: speedup /proc/stat handling

From: Andrew Morton
Date: Thu Jan 26 2012 - 20:18:06 EST


On Fri, 27 Jan 2012 10:09:33 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:

> > I expect most of these numbers are zero. I wonder if we would get
> > useful speedups from
> >
> > for_each_irq_nr(j) {
> > /* Apologetic comment goes here */
> > if (kstat_irqs(j))
> > seq_printf(p, " %u", kstat_irqs(j));
> > else
> > seq_puts(p, " 0");
> > }
>
> Yes. This is very good optimization and shows much optimization.
> I did this at first try but did complicated ones because it seems
> not interesting. (This is my bad habit...)
>
> I'll try again and measure time.

seq_puts() is too slow ;) I bet seq_putc(p, ' ');seq_putc(p, '0') will
complete in negative time.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/