From: Manfred Spraul <manfred@colorfullife.com>
To: Andries Brouwer <aebr@win.tue.nl>
Cc: linux-kernel@vger.kernel.org
Subject: Re: quadratic behaviour
Date: Sat, 21 Sep 2002 16:15:10 +0200 [thread overview]
Message-ID: <3D8C7EEE.7030500@colorfullife.com> (raw)
> 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
next reply other threads:[~2002-09-21 14:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-21 14:15 Manfred Spraul [this message]
2002-09-21 17:02 ` quadratic behaviour 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3D8C7EEE.7030500@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=aebr@win.tue.nl \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.