• Ingo Molnar's avatar
    [PATCH] generic-pidhash-2.5.36-J2, BK-curr · 64cf8edb
    Ingo Molnar authored
    This is the latest version of the generic pidhash patch.  The biggest
    change is the removal of separately allocated pid structures: they are
    now part of the task structure and the first task that uses a PID will
    provide the pid structure.  Task refcounting is used to avoid the
    freeing of the task structure before every member of a process group or
    session has exited.
    
    This approach has a number of advantages besides the performance gains.
    Besides simplifying the whole hashing code significantly, attach_pid()
    is now fundamentally atomic and can be called during create_process()
    without worrying about task-list side-effects.  It does not have to
    re-search the pidhash to find out about raced PID-adding either, and
    attach_pid() cannot fail due to OOM.  detach_pid() can do a simple
    put_task_struct() instead of the kmem_cache_free().
    
    The only minimal downside is the potential pending task structures after
    session leaders or group leaders have exited - but the number of orphan
    sessions and process groups is usually very low - and even if it's
    higher, this can be regarded as a slow execution of the final
    deallocation of the session leader, not some additional burden.
    64cf8edb
pid.c 5.25 KB