From: Andries Brouwer <aebr@win.tue.nl>
To: "Hanumanthu. H" <hanumanthu.hanok@wipro.com>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] pid_max hang again...
Date: Wed, 11 Sep 2002 19:19:34 +0200 [thread overview]
Message-ID: <20020911171934.GA12449@win.tue.nl> (raw)
In-Reply-To: <Pine.LNX.4.33.0209111428280.20725-100000@ccvsbarc.wipro.com>
On Wed, Sep 11, 2002 at 02:29:45PM +0530, Hanumanthu. H 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
>
> And most of others too. One thing that strikes some minds
> immediatly after looking at current pid allocation, is the need
> for improvement. Well, even though the proposals are be clumsy,
> in-efficient (really ?) we should not ignore the fact that this
> is an area to improve. Ok, here is my final (more better) proposal
> which fixes the atomicity problem addressed by ManFred.
>
>
> Lets us have a structure to represent pid, session, pgrp and tgid.
>
> struct idobject {
> struct idobject *id_next;
> struct idobject *id_prev;
> int value;
> atomic_t users;
> task_t *taskp;
> };
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 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.
Andries
next prev parent reply other threads:[~2002-09-11 17:14 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 [this message]
2002-09-11 20:23 ` jw schultz
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=20020911171934.GA12449@win.tue.nl \
--to=aebr@win.tue.nl \
--cc=hanumanthu.hanok@wipro.com \
--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®