Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3659595pxb; Fri, 11 Feb 2022 05:06:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2sx5QJzBZgWrXssb8qmxNqVtztaR1Q31UubBJEfxMHNlZ96CEFCEltFjpUFli1ESlOm7s X-Received: by 2002:a17:902:8f8e:: with SMTP id z14mr1574699plo.28.1644584797402; Fri, 11 Feb 2022 05:06:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644584797; cv=none; d=google.com; s=arc-20160816; b=HDquH5c9ECUPblDOX/8JWRVO1L8gbDeC05XDxBO8Kb+HDaVhB9ckT0KPM2dzkKJla/ wMGPd4HkmV58XzKQgQhChXb3Wwj0g6bwQz7HDS9OEfpMLt+oGT8jiQkbH2auYInu7gmS gOBKFfVBwUrF+1KSx3TCSvZaUzOJeyq72FvRAHJw9JMe/Xjg3tcWRTFn3T1p0j9ldghR b/wRyyAsCTk3uepu+0teQghwskScT1qrWhsIM1VMg2C8TfkOGN6eAB6i3XyJ6CzE/sko kpXK5O+exQ048JqgtipRXUm8AXZHeU5xCMNWxQW2AQdPkYuLktlazLe5TAaIgVuAd/TV S4BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=7wi9DzXRJl7xpfIIYvztSqpa0/2dDXkGYgVXxq1XpKs=; b=xg0xFQjXsyjWjbBKFxFpLF/H4DKyNphsIEQCAQm2yH7ebpfI+DKMB2mFsUYDrMCHmh qkdYCFDhLVUU1cEYI5pHKuiI+eHLCDyT0gV/TVCl8WKjEgV5yngQ3ny9cf4R8htZH6zO pXiDpdVnnsTRPx7Z85DLC1lL3K/pdGL5ZUKTldtwGaPqOWgAebAe+47213SWmu0UzBpS cWootY5n1F5qiCnWbZC+aYkq5QNmFiA8uQLTOs9trUBP0A0uIVmpU4wh14N0c5H+PmlP B4Zr+JDvoR0wqm/OvQO6dx178Cksmh+nDTizn4bI2+D3NA+2sLa4FUC7Y/FIZbpKGO2f 6f6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KkZ+xbIh; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=DsgaWXk8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w36si22171938pga.836.2022.02.11.05.06.22; Fri, 11 Feb 2022 05:06:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=KkZ+xbIh; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=DsgaWXk8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349379AbiBKLRI (ORCPT + 99 others); Fri, 11 Feb 2022 06:17:08 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:40534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349351AbiBKLRD (ORCPT ); Fri, 11 Feb 2022 06:17:03 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B2AAE69; Fri, 11 Feb 2022 03:17:02 -0800 (PST) Date: Fri, 11 Feb 2022 11:16:59 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1644578220; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7wi9DzXRJl7xpfIIYvztSqpa0/2dDXkGYgVXxq1XpKs=; b=KkZ+xbIhOm+CAAXUeSQq30/Qw+5Fp0IV1Rsd5YS21sjE88qibM4supR1PAAw0Rq8bjyMCw HYQsWkLck1z+zBnqu4/EsNnHOFFz2jOOqD4i8ZVbwWasKRFTTtxwcbvgprCPHU4zTT6adb K/+gmKYShfNs6xR7VhSzJD5PGGakJLMFb7+nzILEqnVE878exAbbOkevCDbma0c8889Pcl 9p8J4gzSnCLiDZQXx6yKey0IqL7fQBMsnLQqBIofAYgVd9g8kJFchxgkGxT48W8r9+ziYO TD0m2emhAR1A69c4QUDUNFOO+d/O/s3JicIVeFYIOjR276u6E37rNagFRkX5zg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1644578220; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7wi9DzXRJl7xpfIIYvztSqpa0/2dDXkGYgVXxq1XpKs=; b=DsgaWXk8ytWfM8Z2JWw0hpDc7kFX5wHY4L0MaATQ4jB0iDN0CpfEsSn3zboObGcPmKC4Yj 7909kAvJ4o72sBBg== From: "tip-bot2 for Sebastian Andrzej Siewior" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] locking/local_lock: Make the empty local_lock_*() function a macro. Cc: Sebastian Andrzej Siewior , "Peter Zijlstra (Intel)" , Waiman Long , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <164457821956.16921.6260017427574423665.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the locking/core branch of tip: Commit-ID: 9983a9d577db415c41099a20a5637ab25dd3c240 Gitweb: https://git.kernel.org/tip/9983a9d577db415c41099a20a5637ab25dd3c240 Author: Sebastian Andrzej Siewior AuthorDate: Tue, 08 Feb 2022 18:08:02 +01:00 Committer: Peter Zijlstra CommitterDate: Fri, 11 Feb 2022 12:13:56 +01:00 locking/local_lock: Make the empty local_lock_*() function a macro. It has been said that local_lock() does not add any overhead compared to preempt_disable() in a !LOCKDEP configuration. A micro benchmark showed an unexpected result which can be reduced to the fact that local_lock() was not entirely optimized away. In the !LOCKDEP configuration local_lock_acquire() is an empty static inline function. On x86 the this_cpu_ptr() argument of that function is fully evaluated leading to an additional mov+add instructions which are not needed and not used. Replace the static inline function with a macro. The typecheck() macro ensures that the argument is of proper type while the resulting disassembly shows no traces of this_cpu_ptr(). Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Waiman Long Link: https://lkml.kernel.org/r/YgKjciR60fZft2l4@linutronix.de --- include/linux/local_lock_internal.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/local_lock_internal.h b/include/linux/local_lock_internal.h index 975e33b..6d635e8 100644 --- a/include/linux/local_lock_internal.h +++ b/include/linux/local_lock_internal.h @@ -44,9 +44,9 @@ static inline void local_lock_debug_init(local_lock_t *l) } #else /* CONFIG_DEBUG_LOCK_ALLOC */ # define LOCAL_LOCK_DEBUG_INIT(lockname) -static inline void local_lock_acquire(local_lock_t *l) { } -static inline void local_lock_release(local_lock_t *l) { } -static inline void local_lock_debug_init(local_lock_t *l) { } +# define local_lock_acquire(__ll) do { typecheck(local_lock_t *, __ll); } while (0) +# define local_lock_release(__ll) do { typecheck(local_lock_t *, __ll); } while (0) +# define local_lock_debug_init(__ll) do { typecheck(local_lock_t *, __ll); } while (0) #endif /* !CONFIG_DEBUG_LOCK_ALLOC */ #define INIT_LOCAL_LOCK(lockname) { LOCAL_LOCK_DEBUG_INIT(lockname) }