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));
        }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to