public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: quadratic behaviour
@ 2002-09-21 14:15 Manfred Spraul
  2002-09-21 17:02 ` William Lee Irwin III
  0 siblings, 1 reply; 7+ messages in thread
From: Manfred Spraul @ 2002-09-21 14:15 UTC (permalink / raw)
  To: Andries Brouwer; +Cc: linux-kernel

> Let me repeat this, and call it an observation instead of a question,
> so that you do not think I am in doubt.
> 
> If you have 20000 processes, and do ps, then get_pid_list() will be
> called 1000 times, and the for_each_process() loop will examine
> 10000000 processes.
> 
> Unlike the get_pid() situation, which was actually amortized linear with a very
> small coefficient, here we have a bad quadratic behaviour, still in 2.5.37.
> 
One solution would be to replace the idtag hash with an idtag tree.

Then get_pid_list() could return an array of sorted pids, and finding 
the next pid after unlocking the task_lock would be just a tree lookup 
(find first pid larger than x).

And a sorted tree would make it possible find the next safe range for 
get_pid() with O(N) instead of O(N^2).

--
	Manfred



^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [patch] lockless, scalable get_pid(), for_each_process() elimination, 2.5.35-BK
@ 2002-09-18 21:15 Andries Brouwer
  2002-09-19  3:05 ` Ingo Molnar
  0 siblings, 1 reply; 7+ messages in thread
From: Andries Brouwer @ 2002-09-18 21:15 UTC (permalink / raw)
  To: William Lee Irwin III, Ingo Molnar, Linus Torvalds, linux-kernel

On Wed, Sep 18, 2002 at 01:29:14PM -0700, William Lee Irwin III wrote:

> I've seen no change in behavior with large PID_MAX.

Of course not. But people keep blaming the wrong routine.
I have said it a thousand times - nothing is wrong with get_pid().

Now proc_pid_readdir() takes a million times as long, so it would
be much more reasonable if people talked about it instead.
With 20000 processes it will visit 10^7 process structs
for one ps.

> It doesn't sound like you read the patch at all.

I looked at it and searched for base.c but didnt find it,
so concluded that the real problem was not addressed.

> > In procfs we have a very quadratic algorithm in proc_pid_readdir()/
> > get_pid_list(). Not a potential hiccup after 2^30 processes that some
> > may want to smoothe, but every single "ls /proc" or "ps".
> > What shall we do with /proc for all these people with 10^5 processes?
> > Andries
> 
> That is actually one of the easiest ways to take out one of my machines
> while it's running 10K or so tasks, mentioned a bit ago in this thread.

OK. So we now agree.

But it looks like your patch doesnt change this? Or did I overlook sth?

Andries

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-09-21 17:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-21 14:15 quadratic behaviour Manfred Spraul
2002-09-21 17:02 ` William Lee Irwin III
  -- strict thread matches above, loose matches on Subject: below --
2002-09-18 21:15 [patch] lockless, scalable get_pid(), for_each_process() elimination, 2.5.35-BK Andries Brouwer
2002-09-19  3:05 ` Ingo Molnar
2002-09-19 13:11   ` Andries Brouwer
2002-09-21 12:56     ` quadratic behaviour Andries Brouwer
2002-09-21 17:06       ` Linus Torvalds
2002-09-21 17:35         ` William Lee Irwin III
2002-09-21 17:49         ` Ingo Molnar
2002-09-21 17:46           ` William Lee Irwin III

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox