From owner-svn-src-head@freebsd.org Sun Feb 5 10:00:14 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D28E4CD0903; Sun, 5 Feb 2017 10:00:14 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 94B93308; Sun, 5 Feb 2017 10:00:14 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1caJcB-000JsL-0y; Sun, 05 Feb 2017 13:00:11 +0300 Date: Sun, 5 Feb 2017 13:00:11 +0300 From: Slawa Olhovchenkov To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r313275 - in head/sys: kern sys Message-ID: <20170205100010.GB5366@zxy.spb.ru> References: <201702050804.v1584Cim052478@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201702050804.v1584Cim052478@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Feb 2017 10:00:14 -0000 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?