Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Jun 2018 17:49:34 +0000 (UTC)
From:      Matt Macy <mmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r334623 - head/sys/dev/hwpmc
Message-ID:  <201806041749.w54HnYcO050514@repo.freebsd.org>

Next in thread | Raw E-Mail | Index | Archive | Help
Author: mmacy
Date: Mon Jun  4 17:49:34 2018
New Revision: 334623
URL: https://svnweb.freebsd.org/changeset/base/334623

Log:
  hwpmc: remove gratuitous curthread checks

Modified:
  head/sys/dev/hwpmc/hwpmc_mod.c

Modified: head/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_mod.c	Mon Jun  4 16:46:36 2018	(r334622)
+++ head/sys/dev/hwpmc/hwpmc_mod.c	Mon Jun  4 17:49:34 2018	(r334623)
@@ -4647,16 +4647,12 @@ pmc_add_sample(int cpu, int ring, struct pmc *pm, stru
 
 	counter_u64_add(pm->pm_runcount, 1);	/* hold onto PMC */
 
+	td = curthread;
 	ps->ps_pmc = pm;
-	ps->ps_pid = -1;
-	ps->ps_tid = -1;
-	if ((td = curthread) != NULL) {
-		ps->ps_tid = td->td_tid;
-		if (td->td_proc)
-			ps->ps_pid = td->td_proc->p_pid;
-	}
-	ps->ps_cpu = cpu;
 	ps->ps_td = td;
+	ps->ps_pid = td->td_proc->p_pid;
+	ps->ps_tid = td->td_tid;
+	ps->ps_cpu = cpu;
 	ps->ps_flags = inuserspace ? PMC_CC_F_USERSPACE : 0;
 
 	callchaindepth = (pm->pm_flags & PMC_F_CALLCHAIN) ?
@@ -4715,9 +4711,8 @@ pmc_process_interrupt(int cpu, int ring, struct pmc *p
 
 	td = curthread;
 	if ((pm->pm_flags & PMC_F_USERCALLCHAIN) &&
-		td && td->td_proc &&
-		(td->td_proc->p_flag & P_KPROC) == 0 &&
-		!inuserspace) {
+           (td->td_proc->p_flag & P_KPROC) == 0 &&
+           !inuserspace) {
 		atomic_add_int(&curthread->td_pmcpend, 1);
 		return (pmc_add_sample(cpu, PMC_UR, pm, tf, 0));
 	}



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?201806041749.w54HnYcO050514>