cvs commit: src/sys/kern kern_exit.c kern_resource.c
John Baldwin
jhb at freebsd.org
Mon Jan 23 11:58:25 PST 2006
On Monday 23 January 2006 14:15, Stephan Uphoff wrote:
> ups 2006-01-23 19:15:13 UTC
>
> FreeBSD src repository
>
> Modified files:
> sys/kern kern_exit.c kern_resource.c
> Log:
> Hopefully fix the "calcru: runtime went backwards from ..." problem by
> keeping the resource values locked (where needed) while we use them
> for calculations.
>
> MFC after: 3 days
Why expand the locking in calcru()? calcru1() is working with a static
rusage_ext on calcru()'s stack, not the one for process p that is generated
while sched_lock is held. The 'p' for calcru1() is only used for printfs, no
actual data is taken from p. I think the ruadd() change might be the only
fix needed, though I think the updating of p->p_stats->p_ru.ru_nvcsw and
p->p_ru needs to be deferred as well since the race you seem to be fixing is
the case where exit1() is preempted, but with the current change you'd still
have stale data in p->p_ru (since it is a copy of p->p_stats->p_ru, not a
pointer) unless you move the updating of p->p_ru down to just before the
ruadd() as it was previously.
--
John Baldwin <jhb at FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org
More information about the cvs-src
mailing list