Re: svn commit: r300110 - head/sys/kern
On Tue, May 17, 2016 at 10:22:18PM -0700, NGie Cooper wrote: > > > On May 17, 2016, at 20:55, Mark Johnstonwrote: > > > > Author: markj > > Date: Wed May 18 03:55:54 2016 > > New Revision: 300110 > > URL: https://svnweb.freebsd.org/changeset/base/300110 > > > > Log: > > Do not acquire the thread lock in hardclock_cnt() unless needed. > > > > This function only sets thread flags if a SIGPROF or SIGVTALRM timer > > has fired, which is almost never the case. > > > > MFC after:2 weeks > > > > Modified: > > head/sys/kern/kern_clock.c > > > > Modified: head/sys/kern/kern_clock.c > > == > > --- head/sys/kern/kern_clock.cWed May 18 03:50:21 2016(r300109) > > +++ head/sys/kern/kern_clock.cWed May 18 03:55:54 2016(r300110) > > @@ -570,9 +570,11 @@ hardclock_cnt(int cnt, int usermode) > >flags |= TDF_PROFPEND | TDF_ASTPENDING; > >PROC_ITIMUNLOCK(p); > >} > > -thread_lock(td); > > -td->td_flags |= flags; > > -thread_unlock(td); > > +if (flags != 0) { > > +thread_lock(td); > > +td->td_flags |= flags; > > +thread_unlock(td); > > +} > > Use predict_false? I don't think that's really warranted here. A __predict_false could become incorrect after a future change elsewhere in this function, and this isn't enough of a hot path for such a change to make a measurable difference on its own. > > > > #ifdefHWPMC_HOOKS > >if (PMC_CPU_HAS_SAMPLES(PCPU_GET(cpuid))) > > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r300110 - head/sys/kern
> On May 17, 2016, at 20:55, Mark Johnstonwrote: > > Author: markj > Date: Wed May 18 03:55:54 2016 > New Revision: 300110 > URL: https://svnweb.freebsd.org/changeset/base/300110 > > Log: > Do not acquire the thread lock in hardclock_cnt() unless needed. > > This function only sets thread flags if a SIGPROF or SIGVTALRM timer > has fired, which is almost never the case. > > MFC after:2 weeks > > Modified: > head/sys/kern/kern_clock.c > > Modified: head/sys/kern/kern_clock.c > == > --- head/sys/kern/kern_clock.cWed May 18 03:50:21 2016(r300109) > +++ head/sys/kern/kern_clock.cWed May 18 03:55:54 2016(r300110) > @@ -570,9 +570,11 @@ hardclock_cnt(int cnt, int usermode) >flags |= TDF_PROFPEND | TDF_ASTPENDING; >PROC_ITIMUNLOCK(p); >} > -thread_lock(td); > -td->td_flags |= flags; > -thread_unlock(td); > +if (flags != 0) { > +thread_lock(td); > +td->td_flags |= flags; > +thread_unlock(td); > +} Use predict_false? > > #ifdefHWPMC_HOOKS >if (PMC_CPU_HAS_SAMPLES(PCPU_GET(cpuid))) > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r300110 - head/sys/kern
Author: markj Date: Wed May 18 03:55:54 2016 New Revision: 300110 URL: https://svnweb.freebsd.org/changeset/base/300110 Log: Do not acquire the thread lock in hardclock_cnt() unless needed. This function only sets thread flags if a SIGPROF or SIGVTALRM timer has fired, which is almost never the case. MFC after:2 weeks Modified: head/sys/kern/kern_clock.c Modified: head/sys/kern/kern_clock.c == --- head/sys/kern/kern_clock.c Wed May 18 03:50:21 2016(r300109) +++ head/sys/kern/kern_clock.c Wed May 18 03:55:54 2016(r300110) @@ -570,9 +570,11 @@ hardclock_cnt(int cnt, int usermode) flags |= TDF_PROFPEND | TDF_ASTPENDING; PROC_ITIMUNLOCK(p); } - thread_lock(td); - td->td_flags |= flags; - thread_unlock(td); + if (flags != 0) { + thread_lock(td); + td->td_flags |= flags; + thread_unlock(td); + } #ifdef HWPMC_HOOKS if (PMC_CPU_HAS_SAMPLES(PCPU_GET(cpuid))) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"