Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp580900ybp; Fri, 4 Oct 2019 01:25:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyp62oBywJa70RGvFCYeQ73lo/v0fFVJIKrsq6ox46RfUKejPRQEJKkQONtk5u0TLKkUZl6 X-Received: by 2002:a05:6402:65a:: with SMTP id u26mr13938008edx.86.1570177521334; Fri, 04 Oct 2019 01:25:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570177521; cv=none; d=google.com; s=arc-20160816; b=UXi/XX9e7c6qefWVSZgP8WwZiQ5UfHwWL8fClEnk+huvcN5kMOxzcCTkC5dijbgfaD mrVbAfdiEXbXj+mgZQ0OzarnSkB/oCbb6yrIDkQX96WnasN+CPFIQ9/XEKZk6SGOQFPL gcm2OahOld6UQbv+mGkcDiiM3Hdw00cNR+2KIfOhPVMjmCuenr2GxQS7KnkhuWV1zL2I vbDKkpO31CL3ZtsyZnyAFcFqfyoEAq+mblqbWm+j3nOD+A7u91SznR7isx0N4EiDBAmU F5YX0dW4cx/fPS306OLHFpoiBlUvYtgZVrnGvw+y7Tc8hja4OdVVZa4cr7COtEn1ViQX lT0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=wuBYLzr0+BbgtiiM2Gze6MIPys+898SIQq1AttIPKCY=; b=sSWXT03DuJABTxiIzZZHrIPMK4noLTBZGl3HHtrJ0pmto3h7mttUEJc0YehO7/MVjC a1p0eOciAYjSPfR9TG7rq63S1M3ZbKk6/5qgjBggRsMlmEO/2+L86C8I8HafJgziZ2V7 4WVrirP4c7FRIo6/tpUbfPalAQkPg88q+FfuvQj88NnZ0gcTo6OtKEwkNVuNuyoE/uxy Wlpw2TMbNj0jtAnukot1HpdNjeZuaBu/CQj8MpjR1neJ3Db/kQ2+FHnMqTsYqoQWDKc8 MybPG9LmKPRl7LqUA4T2NWcmUXg4QtrNrftWQBNl4TbJtIAmoB/as5pr0g2Z6VzxZ8Nl x0Xw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n2si3121160edq.264.2019.10.04.01.24.56; Fri, 04 Oct 2019 01:25:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730667AbfJDHiM (ORCPT + 99 others); Fri, 4 Oct 2019 03:38:12 -0400 Received: from mail-oi1-f194.google.com ([209.85.167.194]:42955 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727326AbfJDHiL (ORCPT ); Fri, 4 Oct 2019 03:38:11 -0400 Received: by mail-oi1-f194.google.com with SMTP id i185so4946289oif.9; Fri, 04 Oct 2019 00:38:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wuBYLzr0+BbgtiiM2Gze6MIPys+898SIQq1AttIPKCY=; b=MRd+mGq6ewOTqas5XkvNr1BCOYEjisAhar1cYKA4se1ReDOqYlEWlyH0ChuPqHM+hq GhHPMNBEJS7YdFWf1lgmT1s5X9enwNsS3QpSy1qDRPukBh9JVmZE9hpRL0pFT94mVxka 6OKSuobmi8k87mS/Whe8Q/vTNgB0NTIsofT6C13QCR1rJjoonm4rYQkmDQ8EefSrWixk btu7mFcS0xgpi7m940vaGkXkh/7389Bjp/1UlH/SZ7jjsAHHDTGdSyXw0A/5/m2akaAr cMIH9mpGoNdzOgZJWU25/YWNtSyN5fH8PH9Lb4tMBw/zTobIQ5ADk/VjrwXWlSDzJPPn UMtw== X-Gm-Message-State: APjAAAWm4d5f0g7lQubuCckHy3uiyAxvRq/R6hZp2iDtC4LYkALmlXzb iiYbgVOWsAb31oSmitGLr7OeW2l7JyRF63m/Ju8= X-Received: by 2002:aca:b654:: with SMTP id g81mr5758145oif.153.1570174690802; Fri, 04 Oct 2019 00:38:10 -0700 (PDT) MIME-Version: 1.0 References: <20190930112636.vx2qxo4hdysvxibl@willie-the-truck> <20190930121803.n34i63scet2ec7ll@willie-the-truck> <20191001092823.z4zhlbwvtwnlotwc@willie-the-truck> <20191001170142.x66orounxuln7zs3@willie-the-truck> <20191001175512.GK25745@shell.armlinux.org.uk> <20191001181438.GL25745@shell.armlinux.org.uk> In-Reply-To: From: Geert Uytterhoeven Date: Fri, 4 Oct 2019 09:37:59 +0200 Message-ID: Subject: Re: [PATCH] compiler: enable CONFIG_OPTIMIZE_INLINING forcibly To: Miguel Ojeda Cc: Linus Torvalds , Masahiro Yamada , Nick Desaulniers , Russell King - ARM Linux admin , Will Deacon , Nicolas Saenz Julienne , Andrew Morton , Ingo Molnar , Borislav Petkov , linux-arch , LKML , Catalin Marinas , Stefan Wahren , Kees Cook , Arnd Bergmann , clang-built-linux Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Miguel, On Thu, Oct 3, 2019 at 10:21 PM Miguel Ojeda wrote: > On Thu, Oct 3, 2019 at 7:29 PM Linus Torvalds > wrote: > > On Thu, Oct 3, 2019 at 10:24 AM Masahiro Yamada > > wrote: > > > > > > I just want to annotate __always_inline for the case > > > "2. code that if not inlined is somehow not correct." > > > > Oh, I support that entirely - if only for documentation. > > > > But I do *not* support the dismissal of the architecture maintainers > > concerns about "does it work?" and apparently known compiler bugs. > > > > > Again, not saying "use a macro". > > > > Other people did, though. > > > > And there seemed to be little balancing of the pain vs the gain. The > > gain really isn't that obvious. If the code shrinks by a couple of kB, > > is that good or bad? Maybe it is smaller, but is it _better_? > > I think both positions that people have shown are important to take > into account. > > We should minimize our usage of macros wherever possible and certainly > not write new ones when another solution is available. But we should > *also* minimize our dependence on code that "must-be-inlined" to work > as much as possible. > > In particular, I think we should allow to use __always_inline only if > it doesn't work otherwise, as an alternative before trying the next > worst solution (macros). And avoid using only "inline" when we > actually require inlining, of course. > > And the reasoning for each usage of __always_inline should have a > comment (be it "bad codegen", "performance tanks without it", > "compiler X <= 4.2 refuses to compile"...). Which is also useful for > compiler folks to grep for cases to improve/fix in their compiler! First, we had "inline" and normal functions, where "inline" was used to make sure a function was inlined (e.g. because it contained code paths that were intended to be optimized away[*]). Then, the compiler started not honoring the "inline" keyword, so we got "always_inline", "inline", and normal functions. With a hack to #define "inline" to "always_inline" for some compiler versions. What's next? There should be a way for the programmer to indicate a function must be inlined. [*] Some unused code paths may contain references to symbols that may not exist for the current configuration, or not exist at all. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds