2004-10-25 07:24:42

by Denis Vlasenko

[permalink] [raw]
Subject: [PATCH] reduce top(1) CPU usage by an order of magnitude

Patch is not mine, Paulo Marques <[email protected]>
wrote it.

I tested in on 2.6.9-rc2. top(1) CPU usage went from ~40% to ~4%
(yes, test box is a rather old piece of junk).

The patch applies cleanly to 2.6.9.
--
vda


Attachments:
(No filename) (224.00 B)
kallsyms.diff (25.37 kB)
Download all attachments

2004-10-25 08:19:13

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH] reduce top(1) CPU usage by an order of magnitude

Denis Vlasenko <[email protected]> writes:

> Patch is not mine, Paulo Marques <[email protected]>
> wrote it.

The bug is in your top. It shouldn't read /proc/*/wchan
by default unless the user switches on WCHAN display.
Just disable that and it will be even faster. My top
doesn't read it at all, you probably got some buggy
version.

Also btw we normally let people submit their patches themselves.

-Andi

2004-10-25 08:25:10

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] reduce top(1) CPU usage by an order of magnitude

Denis Vlasenko <[email protected]> wrote:
>
> Patch is not mine, Paulo Marques <[email protected]>
> wrote it.
>
> I tested in on 2.6.9-rc2. top(1) CPU usage went from ~40% to ~4%
> (yes, test box is a rather old piece of junk).
>
> The patch applies cleanly to 2.6.9.

umm, this patch has been in -mm for six weeks, and in Linus's kernel for
one week.

2004-10-25 08:25:11

by Nick Piggin

[permalink] [raw]
Subject: Re: [PATCH] reduce top(1) CPU usage by an order of magnitude

Denis Vlasenko wrote:
> Patch is not mine, Paulo Marques <[email protected]>
> wrote it.
>
> I tested in on 2.6.9-rc2. top(1) CPU usage went from ~40% to ~4%
> (yes, test box is a rather old piece of junk).
>
> The patch applies cleanly to 2.6.9.

Patch is already merged.

2004-10-25 09:05:18

by Denis Vlasenko

[permalink] [raw]
Subject: Re: [PATCH] reduce top(1) CPU usage by an order of magnitude

On Monday 25 October 2004 10:35, Andi Kleen wrote:
> Denis Vlasenko <[email protected]> writes:
>
> > Patch is not mine, Paulo Marques <[email protected]>
> > wrote it.
>
> The bug is in your top. It shouldn't read /proc/*/wchan
> by default unless the user switches on WCHAN display.
> Just disable that and it will be even faster. My top
> doesn't read it at all, you probably got some buggy
> version.

This is top from procps-2.0.18.
You are right, top may skip reading wchan, I will look into it.
However, if I do request WCHAN, I still want top to be fast.

> Also btw we normally let people submit their patches themselves.

I just wanted to prevent this patch from being missed.
--
vda

2004-10-25 09:08:01

by Denis Vlasenko

[permalink] [raw]
Subject: Re: [PATCH] reduce top(1) CPU usage by an order of magnitude

On Monday 25 October 2004 10:36, Andrew Morton wrote:
> Denis Vlasenko <[email protected]> wrote:
> >
> > Patch is not mine, Paulo Marques <[email protected]>
> > wrote it.
> >
> > I tested in on 2.6.9-rc2. top(1) CPU usage went from ~40% to ~4%
> > (yes, test box is a rather old piece of junk).
> >
> > The patch applies cleanly to 2.6.9.
>
> umm, this patch has been in -mm for six weeks, and in Linus's kernel for
> one week.

Good.

Sorry for the noise.
--
vda