/proc/sys/kernel/pid_max issues

From: Anton Blanchard (anton_at_samba.org)
Date: 09/12/04

  • Next message: Andrew Morton: "Re: [PATCH] atomic_inc_return() for i386[1/5] (Re: atomic_inc_return)"
    Date:	Sun, 12 Sep 2004 18:56:09 +1000
    To: linux-kernel@vger.kernel.org
    
    

    Hi,

    I tried creating 100,000 threads just for the hell of it. I was
    surprised that it appears to have worked even with pid_max set at 32k.

    It seems if we are above pid_max we wrap back to RESERVED_PIDS at the
    start of alloc_pidmap but do not enforce this upper limit. I guess every
    call of alloc_pidmap above 32k was wrapping back to RESERVED_PIDS,
    walking the allocated space then allocating off the end.

    Just as an aside, does it make sense to remove the pidmap allocator and
    use the IDR allocator now its there?

    Now once I had managed to allocate those 100,000 threads, I noticed
    this:

    18446744071725383682 dr-xr-xr-x 3 root root 0 Sep 12 08:10 100796

    Strange huh. Turns out we allocate inodes in proc via:

    #define fake_ino(pid,ino) (((pid)<<16)|(ino))

    With 32bit inodes we are screwed once pids go over 64k arent we?

    Anton
    -
    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/


  • Next message: Andrew Morton: "Re: [PATCH] atomic_inc_return() for i386[1/5] (Re: atomic_inc_return)"

    Relevant Pages

    • Re: How to reclaim inode pages on demand
      ... >> that are confusing the hell out of me. ... I was using the allocator to count how many inode-related pages there ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Avoiding external fragmentation with a placement policy Version 12
      ... > fishing in the allocator might well be irrelevant compared to the cost ... > of freeing the necessary memory area? ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: How to reclaim inode pages on demand
      ... On Wed, 2005-08-10 at 18:27 +0100, Mel Gorman wrote: ... > (usually LRU pages). ... it's allocated for the page cache, reclaimed, returned to the allocator, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH 03/05] mm rationalize __alloc_pages ALLOC_* flag names
      ... >>from the terminlogy we've been using in the page allocator ... and MUSTHAVE is not really ... Send instant messages to your online friends http://au.messenger.yahoo.com ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: fix iounmap and a pageattr memleak (x86 and x86-64)
      ... > However if all usages are symmetric, the only pte that should ever get ... I think we're being naughty about page_counts for pages that never hit ... are set back to a state where they cleanly go in to the allocator. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)