Update p_runtime on exit. This fixes calcru() on zombies, and prepares
for not calling calcru() on exit. calcru() on a zombie can happen if ttyinfo() (^T) picks one. PR: 52490
This commit is contained in:
parent
d6a774ca4a
commit
871684b822
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=130842
@ -103,6 +103,7 @@ sys_exit(struct thread *td, struct sys_exit_args *uap)
|
||||
void
|
||||
exit1(struct thread *td, int rv)
|
||||
{
|
||||
struct bintime new_switchtime;
|
||||
struct proc *p, *nq, *q;
|
||||
struct tty *tp;
|
||||
struct vnode *ttyvp;
|
||||
@ -517,10 +518,16 @@ exit1(struct thread *td, int rv)
|
||||
|
||||
mtx_lock_spin(&sched_lock);
|
||||
critical_exit();
|
||||
cnt.v_swtch++;
|
||||
binuptime(PCPU_PTR(switchtime));
|
||||
|
||||
/* Do the same timestamp bookkeeping that mi_switch() would do. */
|
||||
binuptime(&new_switchtime);
|
||||
bintime_add(&p->p_runtime, &new_switchtime);
|
||||
bintime_sub(&p->p_runtime, PCPU_PTR(switchtime));
|
||||
PCPU_SET(switchtime, new_switchtime);
|
||||
PCPU_SET(switchticks, ticks);
|
||||
|
||||
cnt.v_swtch++;
|
||||
|
||||
/*
|
||||
* Allow the scheduler to adjust the priority of the
|
||||
* parent when a kseg is exiting.
|
||||
|
Loading…
Reference in New Issue
Block a user