lkml.org 
[lkml]   [2012]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] proc: speedup /proc/stat handling
On Thu, 26 Jan 2012 18:55:20 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:

> On Wed, 25 Jan 2012 17:04:16 -0800
> Andrew Morton <akpm@linux-foundation.org> wrote:
>
> > On Wed, 25 Jan 2012 06:29:32 +0100
> > Eric Dumazet <eric.dumazet@gmail.com> wrote:
> >
> > > Le mardi 24 janvier 2012 __ 17:27 -0800, Andrew Morton a __crit :
> > >
> > > > I had a fiddle on an 8-way x86_64 machine. I'm unable to demonstrate
> > > > any improvement for either of
> > > >
> > > > time (for i in $(seq 1000); do; cat /proc/self/stat > /dev/null; done)
> > > > time (for i in $(seq 1000); do; cat /proc/1/stat > /dev/null; done)
> > > >
> > > > oh well.
> > >
> > > What size is /proc/stat ?
> >
> > About 40mm, but it depends on the font size.
> >
> > > wc -c /proc/stat
> > >
> > > If under 4096, there is no problem with existing code.
> >
> > akpm2:/home/akpm> wc -c /proc/stat
> > 2800 /proc/stat
> >
> > > I had the problem on a 16-way machine.
> >
> > OK..
>
>
> I wrote following patch just for my fun, which makes /proc/stat twice fast.
> But I'm not sure whether this kind of dirty && special printk is worth to do or not..
> because I can't see /proc/stat cost at shell-scripting.

It is rather a lot of not-very-general infrastructure.

>
> ...
>
> @@ -131,8 +143,8 @@ static int show_stat(struct seq_file *p, void *v)
> seq_printf(p, "intr %llu", (unsigned long long)sum);
>
> /* sum again ? it could be updated? */
> - for_each_irq_nr(j)
> - seq_printf(p, " %u", kstat_irqs(j));
> + j = 0;
> + seq_printnum_batch(p, " %u", &j, get_next_kstat_irq);

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");
}



\
 
 \ /
  Last update: 2012-01-27 01:45    [W:0.068 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site