mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Jan Engelhardt <jengelh@linux01.gwdg.de>
Cc: "linux-os (Dick Johnson)" <linux-os@analogic.com>,
	Linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: pid_t range question
Date: Thu, 09 Feb 2006 11:11:56 -0700	[thread overview]
Message-ID: <m1r76c2yhf.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0602091751220.30108@yvahk01.tjqt.qr> (Jan Engelhardt's message of "Thu, 9 Feb 2006 17:58:34 +0100 (MET)")

Jan Engelhardt <jengelh@linux01.gwdg.de> writes:

>>> On Linux, type pid_t is defined as an int if you look
>>> through all the intermediate definitions such as S32_T,
>>> etc. However, it wraps at 32767, the next value being 300.
>
> There is also an aesthetical reason. If pids were allowed to exceed, say, 
> ten million, you would need a quite wide field in `ps` for the process 
> number which is on "normal desktop user" systems just require 5 or 6 
> decimal places. Well, what I mean, just look at this sample ps output:
>
> 17:59 shanghai:../fs/proc # ps
>         PID TTY          TIME CMD
>           1 -        00:00:00 init [3]
>  4215914607 tty2     00:00:00 bash
>  4215914653 tty2     00:00:00 ps
>
> mingw/msys and cygwin already have this "cosmetic problem" since windows 
> "pids" are usually above one million.

Yes.  Although this I'm not I'm not certain how bad the cosmetic problem
is.  Certainly significant enough that we don't want to change a good
thing when we got it.  But if there were real problems a big pid
would solve I don't expect large pid numbers to stop us.

>>> I know the
>>> code "reserves" the first 300 pids.
>
> I cannot confirm that. When I start in "-b" mode and 'use' up all pids by 
> repeatedly executing /bin/noop, I someday get pids as low as 10 
> again, defined by how many kernel threads there are active before /bin/bash 
> started.

Odd.  When the search wraps it starts searching at 300.
Still there are no locks around last_pid.

>>I know for certain that proc assumes it can fit pid in
>>the upper bits of an ino_t taking the low 16bits for itself
>>so that may the entire reason for the limit.
>>
> inode number in /proc/XXX/fd creation currently is, IIRC
>   ino = (pid << 16) | fd
> which limits both pid to 16 bits and the fdtable to 16 bits. See 
> fs/proc/inode-alloc.txt. At best, procfs should start using 64bit inode 
> numbers.

Well it does use 64bit inode numbers but only on 64bit systems.
Internally /proc doesn't care about the inode it is only for keep find
and friends from getting confused.

Figuring out how to use find_inode_number would likely be interesting,
and a random inode allocation scheme would be interesting.

Eric


  reply	other threads:[~2006-02-09 18:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-07 16:23 linux-os (Dick Johnson)
2006-02-07 22:16 ` Eric W. Biederman
2006-02-08  0:19   ` Ulrich Drepper
2006-02-08  2:39     ` Eric W. Biederman
2006-02-09 16:58   ` Jan Engelhardt
2006-02-09 18:11     ` Eric W. Biederman [this message]
2006-02-09 20:13       ` Jesper Juhl
2006-02-10 13:21         ` Jan Engelhardt
2006-02-15 20:40           ` David Lang
2006-02-15 21:00             ` Eric W. Biederman
2006-02-17 16:38             ` Jan Engelhardt
2006-02-17 21:20               ` David Lang
2006-02-17 21:39                 ` Eric W. Biederman
2006-02-21 11:22                   ` Herbert Poetzl
     [not found] <5DDTr-6Lw-43@gated-at.bofh.it>
     [not found] ` <5DJlY-6J8-29@gated-at.bofh.it>
     [not found]   ` <5EnCK-7Qt-9@gated-at.bofh.it>
     [not found]     ` <5Eoz4-PV-21@gated-at.bofh.it>
     [not found]       ` <5Eqr8-3To-13@gated-at.bofh.it>
2006-02-10  1:19         ` Bodo Eggert

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=m1r76c2yhf.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=jengelh@linux01.gwdg.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-os@analogic.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

Powered by JetHome