Date: Thu, 11 Nov 2010 10:56:46 +0200 From: Kostik Belousov <kostikbel@gmail.com> To: Edward Tomasz Napierala <trasz@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r215111 - head/sys/kern Message-ID: <20101111085646.GL2392@deviant.kiev.zoral.com.ua> In-Reply-To: <201011110815.oAB8FCtQ053881@svn.freebsd.org> References: <201011110815.oAB8FCtQ053881@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] 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; [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAkzbr80ACgkQC3+MBN1Mb4h99ACfdCfNpGex7yopG+W+PnDiLX0a kf0AoOy3AsUUF8S9wbK/XPtqgB9rj0Gm =hpAT -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101111085646.GL2392>
