lkml.org 
[lkml]   [2012]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2] proc: speedup /proc/stat handling
From
Date
Le vendredi 27 janvier 2012 à 10:09 +0900, KAMEZAWA Hiroyuki a écrit :
> On Thu, 26 Jan 2012 16:43:42 -0800
> Andrew Morton <akpm@linux-foundation.org> 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.
>

Also make it generic maybe, and evaluate kstat_irqs(i) once.

seq_put_u32(struct seq_file *m, u32 val);

Converting an "u32" to its decimal representation should be fast, even
for non zero values. Many other users could benefit from this.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-01-27 08:11    [W:0.061 / U:2.052 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site