mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: "linux-os \(Dick Johnson\)" <linux-os@analogic.com>
Cc: "Linux kernel" <linux-kernel@vger.kernel.org>
Subject: Re: pid_t range question
Date: Tue, 07 Feb 2006 15:16:28 -0700	[thread overview]
Message-ID: <m1pslystkz.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0602071122520.327@chaos.analogic.com> (linux-os@analogic.com's message of "Tue, 7 Feb 2006 11:23:56 -0500")

"linux-os \(Dick Johnson\)" <linux-os@analogic.com> 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.
>
> Does anybody know why it doesn't go to 0x7fffffff and
> then wrap to the first unused pid value? I know the
> code "reserves" the first 300 pids. That's not the
> question. I wonder why. Also I see the code setting
> the upper limit as well. I want to know why it is
> set within the range of a short and is not allowed
> to use the full range of an int. Nothing I see in
> the kernel, related to the pid, ever uses a short
> and no 'C' runtime interface limits this either!

I have a vague memory about some old kernel interfaces
where pid was a short.  That said 32768 is also the number
of bits in a page so it is a very good number for the bitmap
allocator we currently have.

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.

> Also, attempts to change /proc/sys/kernel/pid_max fail
> if I attempt to increase it, but I can decrease it
> to where I don't have enough pids available to fork()
> the next command! Is this the correct behavior?

You can increase pid_max if you have a 64bit kernel.

Eric


  reply	other threads:[~2006-02-07 22:17 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 [this message]
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
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=m1pslystkz.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --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