Re: [PATCH] Linux-2.5 fix/improve get_pid()

From: Paul Larson (plars@austin.ibm.com)
Date: Fri Aug 09 2002 - 14:34:17 EST


I suspect that it would actually require more than just this. I tried
this with the same test I've been using and had several failed attepmts
at low numbers by getting wierd unexpected signals (like 28), and then
one that ran for a much longer time and produced an oops with random
garbage to the console (trying to extract this now).

-Paul Larson

On Thu, 2002-08-08 at 17:02, Linus Torvalds wrote:
> ----
> --- 1.2/include/linux/threads.h Tue Feb 5 07:23:04 2002
> +++ edited/include/linux/threads.h Thu Aug 8 14:58:28 2002
> @@ -19,6 +19,7 @@
> /*
> * This controls the maximum pid allocated to a process
> */
> -#define PID_MAX 0x8000
> +#define PID_MASK 0x3fffffff
> +#define PID_MAX (PID_MASK+1)
>
> #endif
> ===== kernel/fork.c 1.57 vs edited =====
> --- 1.57/kernel/fork.c Tue Jul 30 15:49:20 2002
> +++ edited/kernel/fork.c Thu Aug 8 15:00:16 2002
> @@ -142,7 +142,7 @@
> return 0;
>
> spin_lock(&lastpid_lock);
> - if((++last_pid) & 0xffff8000) {
> + if((++last_pid) & ~PID_MASK) {
> last_pid = 300; /* Skip daemons etc. */
> goto inside;
> }
> @@ -157,7 +157,7 @@
> p->tgid == last_pid ||
> p->session == last_pid) {
> if(++last_pid >= next_safe) {
> - if(last_pid & 0xffff8000)
> + if(last_pid & ~PID_MASK)
> last_pid = 300;
> next_safe = PID_MAX;
> }
>
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 15 2002 - 22:00:20 EST