Re: /proc/sys/kernel/pid_max issues

From: William Lee Irwin III
Date: Sun Sep 12 2004 - 04:47:14 EST


On Sun, Sep 12, 2004 at 11:39:43AM +0200, Ingo Molnar wrote:
> --- linux/kernel/pid.c.orig
> +++ linux/kernel/pid.c
> @@ -103,7 +103,7 @@ int alloc_pidmap(void)
> pidmap_t *map;
>
> pid = last_pid + 1;
> - if (pid >= pid_max)
> + if (unlikely(pid >= pid_max))
> pid = RESERVED_PIDS;

Well, this part won't change the wrapping behavior.

On Sun, Sep 12, 2004 at 11:39:43AM +0200, Ingo Molnar wrote:
> offset = pid & BITS_PER_PAGE_MASK;
> @@ -116,6 +116,10 @@ int alloc_pidmap(void)
> * slowpath and that fixes things up.
> */
> return_pid:
> + if (unlikely(pid >= pid_max)) {
> + clear_bit(offset, map->page);
> + goto failure;
> + }
> atomic_dec(&map->nr_free);
> last_pid = pid;
> return pid;

This is too late; it hands back a hard failure without resetting last_pid.


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