• Roland McGrath's avatar
    [PATCH] acct: report single record for multithreaded process · dd8e157f
    Roland McGrath authored
    This patch changes process accounting to write just one record for a
    process with many NPTL threads, rather than one record for each thread.  No
    record is written until the last thread exits.  The process's record shows
    the cumulative time of all the threads that ever lived in that process
    (thread group).  This seems like the clearly right thing and I assume it is
    what anyone using process accounting really would like to see.
    
    There is a race condition between multiple threads exiting at the same time
    to decide which one should write the accounting record.  I couldn't think
    of anything clever using existing bookkeeping that would get this right, so
    I added another counter for this.  (There may be some potential to clean up
    existing places that figure out how many non-zombie threads are in the
    group, now that this count is available.)
    Signed-off-by: default avatarRoland McGrath <roland@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    dd8e157f
fork.c 29.5 KB