On Thu, Nov 11, 2010 at 08:15:12AM +0000, Edward Tomasz Napierala wrote: > Author: trasz > Date: Thu Nov 11 08:15:12 2010 > New Revision: 215111 > URL: http://svn.freebsd.org/changeset/base/215111 > > Log: > Remove unneeded conditional. The commit message is unuseful. Why the conditional is not needed ?
There are two parts of the condition. P_INMEM is irrelevant since accessed data does not live in the kernel stack of the threads (long time gone is user structure). The p_stats structure is allocated during struct proc initialization and cannot be NULL after the system booted. During the boot, proc0 have p_stats empty until initialized. > > Discussed with: kib > > Modified: > head/sys/kern/kern_proc.c > > Modified: head/sys/kern/kern_proc.c > ============================================================================== > --- head/sys/kern/kern_proc.c Thu Nov 11 05:40:39 2010 (r215110) > +++ head/sys/kern/kern_proc.c Thu Nov 11 08:15:12 2010 (r215111) > @@ -778,18 +778,16 @@ fill_kinfo_proc_only(struct proc *p, str > rufetch(p, &kp->ki_rusage); > kp->ki_runtime = cputick2usec(p->p_rux.rux_runtime); > PROC_SUNLOCK(p); > - if ((p->p_flag & P_INMEM) && p->p_stats != NULL) { > - kp->ki_start = p->p_stats->p_start; > - timevaladd(&kp->ki_start, &boottime); > - PROC_SLOCK(p); > - calcru(p, &kp->ki_rusage.ru_utime, &kp->ki_rusage.ru_stime); > - PROC_SUNLOCK(p); > - calccru(p, &kp->ki_childutime, &kp->ki_childstime); > - > - /* Some callers want child-times in a single value */ > - kp->ki_childtime = kp->ki_childstime; > - timevaladd(&kp->ki_childtime, &kp->ki_childutime); > - } > + kp->ki_start = p->p_stats->p_start; > + timevaladd(&kp->ki_start, &boottime); > + PROC_SLOCK(p); > + calcru(p, &kp->ki_rusage.ru_utime, &kp->ki_rusage.ru_stime); > + PROC_SUNLOCK(p); > + calccru(p, &kp->ki_childutime, &kp->ki_childstime); > + > + /* Some callers want child-times in a single value */ > + kp->ki_childtime = kp->ki_childstime; > + timevaladd(&kp->ki_childtime, &kp->ki_childutime); > tp = NULL; > if (p->p_pgrp) { > kp->ki_pgid = p->p_pgrp->pg_id;
pgpnl8cXMGTZZ.pgp
Description: PGP signature