Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2292104pxb; Wed, 9 Feb 2022 15:20:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJw16Qmn7pC8hMSEonf53wFJMF4ssBQncpPZ7f3S9RTrRJiQueBByp0H7wJCPUJvVOHFenmX X-Received: by 2002:a17:902:db0e:: with SMTP id m14mr4461562plx.65.1644448849583; Wed, 09 Feb 2022 15:20:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644448849; cv=none; d=google.com; s=arc-20160816; b=rW3Q86s9Tgy1F7acsc+KnDHeHOFj/NUSwDtrcmAakXNUJZ+21BXpKs7egRHFKlvcAr hUr0uyPjVPDOxv2vimZLRYmEKbeub1r/cdDzLkIhSCAKAzRlb38aKmO0t2Ng4nJThGIA 3hB7LKWkyo9fh9rRHEZylgTl2+7tY3nG8qkUzVJV2q9ZdXmNfA6Wo6VZK3g9dd4k0+sG C6LxTnxc/oXq2j4jVGaq4fR2PkJEmPZmsvLf8CWmLxZ/y6lLQh90hSUAYtl/fNlMR+bU dsPyFRDJCSyez7VSd+zeejX0BKpCjT+cYsE1OoZUaNFXYqnz+Wobf3fRbcL3Y1ThPT6R ximA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=sjB0G4oldux94CBH1BNUvRbZxqcftmBnTTiYDxZfOek=; b=TyRonkUv7WKY6x5OiS2+9YNpz2NWZ5/skJfjpoc8CuQa7LS1S1TVWXtj29eXjF4MVK m9YWZEF7PdP1cZxqeRQxSfJ8vp89tV1rxKkdX60pUmXRbzatFjqQQCDkYrSqBHF4j2cZ QgGILYAACAy3lVxjPnWgt+lZK2q6ytexiy+jCAysluU04FgqMVAUNU7sL2kHTQKUP7Av CQhtT+EPumRR8mrrY593X+vE5Ez9v2Evh+Za19zhZDaQ9veZwWgupRgv+MMghRBZNkiD YikcAG/SPoJlwOzaDCRoS6Bkmekbh1aS2hGJRhVg2SIaW0cmIfXvsuPjOYrw669/ZNwz Ak+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h62si2011950pge.476.2022.02.09.15.20.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 15:20:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A7CC8E053FA5; Wed, 9 Feb 2022 15:17:26 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233053AbiBIVPk (ORCPT + 99 others); Wed, 9 Feb 2022 16:15:40 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:40912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232999AbiBIVPj (ORCPT ); Wed, 9 Feb 2022 16:15:39 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44272C1DC161 for ; Wed, 9 Feb 2022 13:15:41 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 045251F391; Wed, 9 Feb 2022 21:15:40 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 48ABB13638; Wed, 9 Feb 2022 21:15:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Q+/QAfkuBGJyIwAAMHmgww (envelope-from ); Wed, 09 Feb 2022 21:15:37 +0000 Date: Wed, 9 Feb 2022 13:08:24 -0800 From: Davidlohr Bueso To: Sebastian Andrzej Siewior Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Waiman Long , Ingo Molnar , Will Deacon , Thomas Gleixner Subject: Re: [PATCH REPOST] locking/local_lock: Make the empty local_lock_*() function a macro. Message-ID: <20220209210824.wwsq63z4o6a6ei7a@offworld> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20211029 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Tue, 08 Feb 2022, Sebastian Andrzej Siewior wrote: >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 >Reviewed-by: Waiman Long Reviewed-by: Davidlohr Bueso