mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Martin J. Bligh" <mbligh@aracnet.com>
To: "Hanumanthu. H" <hanumanthu.hanok@wipro.com>,
	linux-kernel@vger.kernel.org
Cc: manfred@colorfullife.com
Subject: Re: [PATCH] pid_max hang again...
Date: Mon, 09 Sep 2002 08:07:05 -0700	[thread overview]
Message-ID: <307667352.1031558825@[10.10.2.3]> (raw)
In-Reply-To: <Pine.LNX.4.33.0209091836470.14828-100000@ccvsbarc.wipro.com>

> Thanks to Manfred, to clarfy me further that my patch doesn't
> work. But I am still in feeling that current pid allocation can
> be improved. If we assume that the atomicity problem with pid
> allocation and linking task struct into process list can be
> ignored (sorry Manfred), does it make any sense to maintain a
> list of `freed' pids ?  For me (some of others too !!), it makes
> lot of sense to re-use pids of exited processes.
> 
> If I am not wrong, an exiting process pid can be re-used (after
> the task dies) if its pid
> 
> 1) not used as session ID (i.e p->session != p->pid)
>    (or p->leader == 0)
> 2) not used as process group ID (p->pgrp != p->pid)
> 3) not used as thread group-ID (p->tgid != p->pid)

How do you track this? Can you keep a reference count for each
PID and score 1 for each of the above usages (and one for normal
use)? Or do you think it's better to just fall back to the current
system in the non-trivial case?
 
> Lets us maintain a list of atmost (PAGE_SIZE /sizeof(pid))
> entries for freed pids, protected by a spin_lock (freepid_lock)
> and let last_pid start from (300 + num_free_pids).

OK, well whilst you're at it, do you want make the free pid list
per CPU with no locking, and make it even more efficient? ;-) 
We now have plenty of free PIDs to play with, and you could refill
the list with 100 entries or so if you had to fall back to scanning.
Actually, you could do that even if your current proposal doesn't
work out ....

> Let me know if it is worth implementing this.

Personally, I think it'd be great ... the current scanning doesn't 
seem like an efficient algorithm at all.

M.


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

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-07  9:06 Manfred Spraul
2002-09-09 14:22 ` Hanumanthu. H
2002-09-09 15:07   ` Martin J. Bligh [this message]
2002-09-09 22:39     ` jw schultz
2002-09-10  9:54       ` Andries Brouwer
2002-09-10 19:29         ` jw schultz
  -- strict thread matches above, loose matches on Subject: below --
2002-09-11  8:59 Hanumanthu. H
2002-09-11 17:19 ` Andries Brouwer
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
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='307667352.1031558825@[10.10.2.3]' \
    --to=mbligh@aracnet.com \
    --cc=hanumanthu.hanok@wipro.com \
    --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

all inboxes | Powered by JetHome®