[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4F1D3792.4090800@parallels.com>
Date: Mon, 23 Jan 2012 14:33:54 +0400
From: Glauber Costa <glommer@...allels.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
CC: Eric Dumazet <eric.dumazet@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Ingo Molnar <mingo@...e.hu>, <linux-kernel@...r.kernel.org>,
Russell King - ARM Linux <linux@....linux.org.uk>,
Paul Tuner <pjt@...gle.com>
Subject: Re: [PATCH] proc: speedup /proc/stat handling
On 01/23/2012 02:16 PM, KAMEZAWA Hiroyuki wrote:
> On Fri, 20 Jan 2012 16:59:24 +0100
> Eric Dumazet<eric.dumazet@...il.com> wrote:
>
>> On a typical 16 cpus machine, "cat /proc/stat" gives more than 4096
>> bytes, and is slow :
>>
>> # strace -T -o /tmp/STRACE cat /proc/stat | wc -c
>> 5826
>> # grep "cpu " /tmp/STRACE
>> read(0, "cpu 1949310 19 2144714 12117253"..., 32768) = 5826<0.001504>
>>
>>
>> Thats partly because show_stat() must be called twice since initial
>> buffer size is too small (4096 bytes for less than 32 possible cpus)
>>
>> Fix this by :
>>
>> 1) Taking into account nr_irqs in the initial buffer sizing.
>>
>> 2) Using ksize() to allow better filling of initial buffer.
>>
>> 3) Reduce the bloat on "intr ..." line :
>> Dont output trailing " 0" values at the end of irq range.
>>
>> An alternative to 1) would be to remember the largest m->count reached
>> in show_stat()
>>
>
> nice catch. But how about using usual seq_file rather than single_open() ?
> I just don't like multi-page buffer for this small file...very much.
>
> A rough patch here, maybe optimization will not be enough. (IOW, this may be slow.)
>
I myself don't like it very much, at least at first sight.
Even with optimizations applied, I doubt we can make this approach
faster than what we currently do for /proc/stat.
Also, the code gets a lot harder to read and grasp. Problem is, unlike
most of the stuff using seq_file, /proc/stat shows a lot of different
kinds of information, not a single kind of easily indexable information.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists