public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: Manfred Spraul <manfred@colorfullife.com>
Cc: Andries Brouwer <aebr@win.tue.nl>, linux-kernel@vger.kernel.org
Subject: Re: quadratic behaviour
Date: Sat, 21 Sep 2002 10:02:40 -0700	[thread overview]
Message-ID: <20020921170240.GP3530@holomorphy.com> (raw)
In-Reply-To: <3D8C7EEE.7030500@colorfullife.com>

At some point in the past, Andries Brouwer wrote:
>> 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.

On Sat, Sep 21, 2002 at 04:15:10PM +0200, Manfred Spraul wrote:
> 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).

There are incremental / O(1) methods for filling the directory as well.

Also, a tree does not preclude additional hashing. Personally, I'd
consider O(N) catastrophic as well, especially when done on multiple
cpus simultaneously. In fact, a large chunk of this is obtaining hard
bounds on the hold time of the tasklist_lock so writers have a remote
chance of getting into critical sections.

Another very important aspect of it is that the tasklist cachelines
aren't incessantly pounded, which is important even for UP.

At any rate, if you care to send something to me I will doublecheck
whether it NMI oopses on my machines.


Cheers,
Bill

  reply	other threads:[~2002-09-21 17:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-21 14:15 quadratic behaviour Manfred Spraul
2002-09-21 17:02 ` William Lee Irwin III [this message]
  -- 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=20020921170240.GP3530@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=aebr@win.tue.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox