Remove unneeded assert for curproc. Simplify.
Reported by: syzkaller by markj Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
d98eb707b0
commit
0783b70974
@ -254,11 +254,8 @@ void
|
|||||||
kern_thread_cputime(struct thread *targettd, struct timespec *ats)
|
kern_thread_cputime(struct thread *targettd, struct timespec *ats)
|
||||||
{
|
{
|
||||||
uint64_t runtime, curtime, switchtime;
|
uint64_t runtime, curtime, switchtime;
|
||||||
struct proc *p;
|
|
||||||
|
|
||||||
if (targettd == NULL) { /* current thread */
|
if (targettd == NULL) { /* current thread */
|
||||||
p = curthread->td_proc;
|
|
||||||
PROC_LOCK_ASSERT(p, MA_OWNED);
|
|
||||||
critical_enter();
|
critical_enter();
|
||||||
switchtime = PCPU_GET(switchtime);
|
switchtime = PCPU_GET(switchtime);
|
||||||
curtime = cpu_ticks();
|
curtime = cpu_ticks();
|
||||||
@ -266,8 +263,7 @@ kern_thread_cputime(struct thread *targettd, struct timespec *ats)
|
|||||||
critical_exit();
|
critical_exit();
|
||||||
runtime += curtime - switchtime;
|
runtime += curtime - switchtime;
|
||||||
} else {
|
} else {
|
||||||
p = targettd->td_proc;
|
PROC_LOCK_ASSERT(targettd->td_proc, MA_OWNED);
|
||||||
PROC_LOCK_ASSERT(p, MA_OWNED);
|
|
||||||
thread_lock(targettd);
|
thread_lock(targettd);
|
||||||
runtime = targettd->td_runtime;
|
runtime = targettd->td_runtime;
|
||||||
thread_unlock(targettd);
|
thread_unlock(targettd);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user