Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Feb 2020 21:02:08 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r357530 - head/sys/kern
Message-ID:  <202002042102.014L28em011948@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Feb  4 21:02:08 2020
New Revision: 357530
URL: https://svnweb.freebsd.org/changeset/base/357530

Log:
  Remove unneeded assert for curproc.  Simplify.
  
  Reported by:	syzkaller by markj
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/kern/kern_time.c

Modified: head/sys/kern/kern_time.c
==============================================================================
--- head/sys/kern/kern_time.c	Tue Feb  4 20:40:45 2020	(r357529)
+++ head/sys/kern/kern_time.c	Tue Feb  4 21:02:08 2020	(r357530)
@@ -254,11 +254,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();
@@ -266,8 +263,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002042102.014L28em011948>