svn commit: r313275 - in head/sys: kern sys

Mateusz Guzik mjguzik at gmail.com
Sun Feb 5 10:01:35 UTC 2017


On Sun, Feb 05, 2017 at 01:00:11PM +0300, Slawa Olhovchenkov wrote:
> On Sun, Feb 05, 2017 at 08:04:12AM +0000, Mateusz Guzik wrote:
> 
> > Author: mjg
> > Date: Sun Feb  5 08:04:11 2017
> > New Revision: 313275
> > URL: https://svnweb.freebsd.org/changeset/base/313275
> > 
> > Log:
> >   mtx: move lockstat handling out of inline primitives
> >   
> >   Lockstat requires checking if it is enabled and if so, calling a 6 argument
> >   function. Further, determining whether to call it on unlock requires
> >   pre-reading the lock value.
> >   
> >   This is problematic in at least 3 ways:
> >   - more branches in the hot path than necessary
> >   - additional cacheline ping pong under contention
> >   - bigger code
> >   
> >   Instead, check first if lockstat handling is necessary and if so, just fall
> >   back to regular locking routines. For this purpose a new macro is introduced
> >   (LOCKSTAT_PROFILE_ENABLED).
> >   
> >   LOCK_PROFILING uninlines all primitives. Fold in the current inline lock
> >   variant into the _mtx_lock_flags to retain the support. With this change
> >   the inline variants are not used when LOCK_PROFILING is defined and thus
> >   can ignore its existence.
> >   
> >   This results in:
> >      text	   data	    bss	    dec	    hex	filename
> >   22259667	1303208	4994976	28557851	1b3c21b	kernel.orig
> >   21797315	1303208	4994976	28095499	1acb40b	kernel.patched
> >   
> >   i.e. about 3% reduction in text size.
> >   
> >   A remaining action is to remove spurious arguments for internal kernel
> >   consumers.
> 
> Do you planed MFC all of this?

Yes, around march.

-- 
Mateusz Guzik <mjguzik gmail.com>


More information about the svn-src-all mailing list