On Thu, Nov 03, 2005 at 11:02:01PM -0600, Mike Gerdts wrote:
> - As the process is exiting (wow, exiting is a lot of work!) it adds
> its children's usr and sys time to its own usr and sys time.
> 
> http://cvs.opensolaris.org/source/xref/on/usr/src/uts/common/os/exit.c#1172
> 
>    1124 void
>    1125 freeproc(proc_t *p)
>    1126 {
> ...
>    1172               p->p_nextofkin->p_cutime += p->p_utime;
>    1173               p->p_nextofkin->p_cstime += p->p_stime;
> 
> - The sums calculated above are propagated to the parent process. 
> Kinda sad that the parent process is the "next of kin".
> - It seems as though there may be a race condition here.  I'm not sure
> that the operations on lines 1172 and 1173 are protected by a lock. 
> It seems as though p->p_nextofkin->p_lock should be held when
> incrementing these values in the event that multiple children are
> being reaped at the same time.

This is protected by pidlock:

void
freeproc(proc_t *p)
{
        proc_t *q;
 
        ASSERT(p->p_stat == SZOMB); 
        ASSERT(p->p_tlist == NULL);
        ASSERT(MUTEX_HELD(&pidlock));

so only one process being processed at a time. (one of the many reasons
pidlock is hard to break up.  pidlock breakup so is a reoccurring hallway
conversation 'round these parts.)

Cheers,
- jonathan

-- 
Jonathan Adams, Solaris Kernel Development
_______________________________________________
perf-discuss mailing list
perf-discuss@opensolaris.org

Reply via email to