svn commit: r366289 - stable/12/sys/kern

Konstantin Belousov kib at FreeBSD.org
Wed Sep 30 13:21:18 UTC 2020


Author: kib
Date: Wed Sep 30 13:21:17 2020
New Revision: 366289
URL: https://svnweb.freebsd.org/changeset/base/366289

Log:
  MFC r357530:
  Remove unneeded assert for curproc.  Simplify.

Modified:
  stable/12/sys/kern/kern_time.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/kern_time.c
==============================================================================
--- stable/12/sys/kern/kern_time.c	Wed Sep 30 12:16:36 2020	(r366288)
+++ stable/12/sys/kern/kern_time.c	Wed Sep 30 13:21:17 2020	(r366289)
@@ -255,11 +255,8 @@ void
 kern_thread_cputime(struct thread *targettd, struct timespec *ats)
 {
 	uint64_t runtime, curtime, switchtime;
-	struct proc *p;
 
 	if (targettd == NULL) { /* current thread */
-		p = curthread->td_proc;
-		PROC_LOCK_ASSERT(p, MA_OWNED);
 		critical_enter();
 		switchtime = PCPU_GET(switchtime);
 		curtime = cpu_ticks();
@@ -267,8 +264,7 @@ kern_thread_cputime(struct thread *targettd, struct ti
 		critical_exit();
 		runtime += curtime - switchtime;
 	} else {
-		p = targettd->td_proc;
-		PROC_LOCK_ASSERT(p, MA_OWNED);
+		PROC_LOCK_ASSERT(targettd->td_proc, MA_OWNED);
 		thread_lock(targettd);
 		runtime = targettd->td_runtime;
 		thread_unlock(targettd);


More information about the svn-src-stable mailing list