From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A771C4167D for ; Mon, 13 Nov 2023 19:09:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231635AbjKMTJK (ORCPT ); Mon, 13 Nov 2023 14:09:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjKMTJI (ORCPT ); Mon, 13 Nov 2023 14:09:08 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB3A410D0; Mon, 13 Nov 2023 11:09:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=PRaP26uLRIaPUrqCO1u+n8xWlzTOZc8MxJaS8V8h730=; b=OrrCkCNw20xRbhRNOU25FUUF+h tSAGAQvoF7CbCxtxcmg8GoEVsUAuMT/tW2YsT48IzTnFv9p08lM+jyrbiMAAyx4jkHqdvWsvivjB6 JfBnItjIV4efAdAUamlDy5wBmg67+vz1EQNJsynuiqGF1KPJqiWU3MNr/c7IkbCq4K40=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1r2cIa-00065F-Pu; Mon, 13 Nov 2023 20:08:40 +0100 Date: Mon, 13 Nov 2023 20:08:40 +0100 From: Andrew Lunn To: Alexander Lobakin Cc: Yury Norov , Andy Shevchenko , Rasmus Villemoes , Alexander Potapenko , Jakub Kicinski , Przemek Kitszel , netdev@vger.kernel.org, linux-btrfs@vger.kernel.org, dm-devel@redhat.com, ntfs3@lists.linux.dev, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 04/11] linkmode: convert linkmode_{test,set,clear,mod}_bit() to macros Message-ID: <33967a01-9ed0-43db-a615-907abab989b7@lunn.ch> References: <20231113173717.927056-1-aleksander.lobakin@intel.com> <20231113173717.927056-5-aleksander.lobakin@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231113173717.927056-5-aleksander.lobakin@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 13, 2023 at 06:37:10PM +0100, Alexander Lobakin wrote: > Since commit b03fc1173c0c ("bitops: let optimize out non-atomic bitops > on compile-time constants"), the non-atomic bitops are macros which can > be expanded by the compilers into compile-time expressions, which will > result in better optimized object code. Unfortunately, turned out that > passing `volatile` to those macros discards any possibility of > optimization, as the compilers then don't even try to look whether > the passed bitmap is known at compilation time. In addition to that, > the mentioned linkmode helpers are marked with `inline`, not > `__always_inline`, meaning that it's not guaranteed some compiler won't > uninline them for no reason, which will also effectively prevent them > from being optimized (it's a well-known thing the compilers sometimes > uninline `2 + 2`). > Convert linkmode_*_bit() from inlines to macros. Their calling > convention are 1:1 with the corresponding bitops, so that it's not even > needed to enumerate and map the arguments, only the names. No changes in > vmlinux' object code (compiled by LLVM for x86_64) whatsoever, but that > doesn't necessarily means the change is meaningless. > > Reviewed-by: Przemek Kitszel > Acked-by: Jakub Kicinski > Signed-off-by: Alexander Lobakin Reviewed-by: Andrew Lunn Andrew