mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: jw schultz <jw@pegasys.ws>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pid_max hang again...
Date: Wed, 11 Sep 2002 13:23:34 -0700	[thread overview]
Message-ID: <20020911202333.GB10315@pegasys.ws> (raw)
In-Reply-To: <20020911171934.GA12449@win.tue.nl>

On Wed, Sep 11, 2002 at 07:19:34PM +0200, Andries Brouwer wrote:
> > >> I don't know what the problem is. The present scheme is very
> > >> efficient on the average (since the pid space is very large,
> > >> much larger than the number of processes, this scan is hardly
> > >> ever done)
> > 
> > > The scan itself i don't mind. It is the rescan that bothers me
> 
> Again. We have 2^30 = 10^9 pids. In reality there are fewer than 10^4
> processes. So once in 10^5 pid allocations do we make a scan over
> these 10^4 processes, that is: for each pid allocation we look at
> 0.1 other processes. This 0.1 is a small number. As soon as you start
> introducing structures that have to be updated for each fork or exit,
> things become at least ten times as expensive as they are now.

Some clarification.  The problems were triggered when
PID_MAX was 2^15.  Linus has bumped it with a recomendation
of somthing on the order of 2^20 - 2^24 not 2^30 
to allow for SSI clusters.

Once last_pid cylces we do a complete scan of the task list
testing four task_struct values for every free pid we get.
If the attempted pid is in use the scan will abort
(somewhere about half way through, perhaps less, on average)
and a new scan will be started.  The increase of PID_MAX will
(when it takes effect) dramatically reduce the frequency of
collisons causing rescans but not eliminate them.

I am less certain than you that a little more structure
managment on fork and exit might not reduce the amount of
scanning we have to do.  From what i see in sched there is
lot of task list scanning going on there as well.  Structure
management is a fixed cost.  The cost of scanning the entire
task list is linear.

> Some polishing is possible in that code. I think I once gave a shorter
> and more efficient version. The fragment "if(last_pid & ~PID_MASK);
> last_pid = 300;" occurs twice, and the correct version has it only once.
> The correct version does not have the "goto inside".
> 
> But, the code may only become smaller and more beautiful.
> Large ugly code can be justified only by the need for efficiency,
> and there is no such need here, and indeed, none of the proposals
> made things more efficient. Once the number of processes gets
> above 10^5 we can invent simpleminded schemes to make this
> for_each_task faster.

Let's relax and see what comes out.  Maybe someone will
suprise you.  I trust Linus to reject patches that make
things worse especially if they haven't been vetted by a
leutenant.

-- 
________________________________________________________________
	J.W. Schultz            Pegasystems Technologies
	email address:		jw@pegasys.ws

		Remember Cernan and Schmitt

  reply	other threads:[~2002-09-11 20:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-11  8:59 Hanumanthu. H
2002-09-11 17:19 ` Andries Brouwer
2002-09-11 20:23   ` jw schultz [this message]
2002-09-12  1:11   ` Rik van Riel
2002-09-12  1:54   ` Andrew Morton
2002-09-12 20:23     ` Andries Brouwer
2002-09-12 21:17       ` Rik van Riel
2002-09-12 21:21         ` yodaiken
2002-09-13  5:47       ` Hanumanthu. H
  -- strict thread matches above, loose matches on Subject: below --
2002-09-07  9:06 Manfred Spraul
2002-09-09 14:22 ` Hanumanthu. H
2002-09-09 15:07   ` Martin J. Bligh
2002-09-09 22:39     ` jw schultz
2002-09-10  9:54       ` Andries Brouwer
2002-09-10 19:29         ` jw schultz
2002-09-07  8:16 Hanumanthu. H
2002-09-06 21:06 Manfred Spraul
2002-09-06 15:39 Ingo Molnar
2002-09-06 17:43 ` [PATCH] " Paul Larson

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=20020911202333.GB10315@pegasys.ws \
    --to=jw@pegasys.ws \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®