Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2280216ybk; Mon, 11 May 2020 17:07:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFVDinvmdTAVUGnV/5ZKykytSfPcyQFNUW3eh3JrZ5zuXVey2LTnTon+4Y6vF/tG9iMMxY X-Received: by 2002:a50:e04c:: with SMTP id g12mr595307edl.74.1589242045220; Mon, 11 May 2020 17:07:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589242045; cv=none; d=google.com; s=arc-20160816; b=cQJw8cNyaabKAgmu7d95/TTXsM9HhipE90PENvVnIpnDXlaZ23s7MCED2faTCSHb6L 9FZxOpsUYrf2kmOmyyuSPXmJ3ZlUTBvkLNd0sXwF5J8Khh6sAQQ5dQNBxGTmEcmMAACh Dgiuk5RRgJqBUs3XC8uRRWqa4sBPqD+K0IE07c4lGtaeIAvF8djQbtvj7DzDCjP10ODE /NPL0Fx1TkPChXgbxkFUDDMFeygzSoDtt5668X+mHW2n01NTWqWQmjhKNW9sxnUMYr+2 gIJhSmCs30JWOF21r1ZHoZ7N0hLdwmgZrT28VpX2I4V3w972nj2LfS+dQfmuU8YSNMvV adNQ== 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:dkim-signature; bh=g5Vj2zQnFxzww1DFlagDjlY/ke7T1Z1ZZyehhz3heRw=; b=XKytV9yDj9agzcQE5umtY4RWlaMtxxGzfJmK/p3ReLyfwke12B70QbhiXOcYSvcrCp jhBweyCenlUhqRHiFVwVapm6edkb5rZWnB47N6W2LHD/7gof+iOKr4uD4uWEt2X22xJS MONWhuP7IP0e52E4/JiJAts2LznuD+SYjIkdNR6KRfvfYASl3UlQyz7UVRZg3bqRMbmF rMrdGqYnmwKypgeeiya1qAUWNF6FME/NmeFake5fiw3ket6o2DCB3ZQpqVm5TnlkPBi5 rOObAnxMM1D6Qy/hBg1nhm9AKe50dFg1ATkNpw21WL/Slz2wCoI/Fzr51xFJc9iTsinl 7Ctg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=hcCGC2Hj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j2si3480868ejs.531.2020.05.11.17.07.02; Mon, 11 May 2020 17:07:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=hcCGC2Hj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728248AbgELAFS (ORCPT + 99 others); Mon, 11 May 2020 20:05:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725836AbgELAFR (ORCPT ); Mon, 11 May 2020 20:05:17 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4EAFC061A0C for ; Mon, 11 May 2020 17:05:16 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id b26so9040249lfa.5 for ; Mon, 11 May 2020 17:05:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=g5Vj2zQnFxzww1DFlagDjlY/ke7T1Z1ZZyehhz3heRw=; b=hcCGC2Hjo9nph3jrRydschmaR9AWBPPm9PAXs2M7D48jJzPcQ/KQADnqlDpnbnJWU2 FMk/VAczA3dIzQWm/k5t7DbIXUsXBEjJ+AkRztrSEyQksG0iw5ouUugZlBp6wOhhj8E8 Qjh8V3jCkhFfic+LUce/yQLpldSBlnv4B00B0= 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=g5Vj2zQnFxzww1DFlagDjlY/ke7T1Z1ZZyehhz3heRw=; b=XJbRPABeIDRyYsX3vw0jSy0qItu5LjR+LtThlL5JARjgiwlYxRegm7esdPZjq3MhwD rZAX+eLF7e6kKwi+ebHr2WTIHh/7rOAl7lAdDMPEopZLBabMqFtmLG3ELWsoLlq/nL76 l+GNlAigQ5gDXSUbFeV8iseIQaC6VOVM50gWIelnxSgnT1vizn6N7svQVMwJaHYBLok3 ZGSJ6veqWcYjs5xGT+gbrb6h63UOHVYqUO43xHLNZdhSYUH0WmU3ngrk2dK67vnaIIbh 6HkeQ3omj0HDmwI+imO+qRaIX58s5LeTKXO5XG41sMIqVGyAeSxFV8BCBSoX/HKokq86 Tk3g== X-Gm-Message-State: AOAM533gP2TqPMdLLvuOm2AQedLTqslcGmz74zBWBv0TsbGziKxzxDPV OtTBHS+xdkTMPUv0O9iw8IGnN7M5Xzc= X-Received: by 2002:a05:6512:3b2:: with SMTP id v18mr12539634lfp.140.1589241913887; Mon, 11 May 2020 17:05:13 -0700 (PDT) Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com. [209.85.167.45]) by smtp.gmail.com with ESMTPSA id s27sm11165246ljo.80.2020.05.11.17.05.12 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 May 2020 17:05:12 -0700 (PDT) Received: by mail-lf1-f45.google.com with SMTP id u4so9028547lfm.7 for ; Mon, 11 May 2020 17:05:12 -0700 (PDT) X-Received: by 2002:ac2:5df9:: with SMTP id z25mr12792137lfq.125.1589241912072; Mon, 11 May 2020 17:05:12 -0700 (PDT) MIME-Version: 1.0 References: <20200508090202.7s3kcqpvpxx32syu@butterfly.localdomain> <20200511215720.303181-1-Jason@zx2c4.com> In-Reply-To: <20200511215720.303181-1-Jason@zx2c4.com> From: Linus Torvalds Date: Mon, 11 May 2020 17:04:56 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] Kconfig: default to CC_OPTIMIZE_FOR_PERFORMANCE_O3 for gcc >= 10 To: "Jason A. Donenfeld" Cc: Linux Kernel Mailing List , Linux Kbuild mailing list , "the arch/x86 maintainers" , stable , "H.J. Lu" , Peter Zijlstra , Jakub Jelinek , Oleksandr Natalenko , Arnd Bergmann , Andrew Morton , David Laight , Masahiro Yamada 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 On Mon, May 11, 2020 at 2:57 PM Jason A. Donenfeld wrote: > > GCC 10 appears to have changed -O2 in order to make compilation time > faster when using -flto, seemingly at the expense of performance, in > particular with regards to how the inliner works. Since -O3 these days > shouldn't have the same set of bugs as 10 years ago, this commit > defaults new kernel compiles to -O3 when using gcc >= 10. I'm not convinced this is sensible. -O3 historically does bad things with gcc. Including bad things for performance. It traditionally makes code larger and often SLOWER. And I don't mean slower to compile (although that's an issue). I mean actually generating slower code. Things like trying to unroll loops etc makes very little sense in the kernel, where we very seldom have high loop counts for pretty much anything. There's a reason -O3 isn't even offered as an option. Maybe things have changed, and maybe they've improved. But I'd like to see actual numbers for something like this. Not inlining as aggressively is not necessarily a bad thing. It can be, of course. But I've actually also done gcc bugreports about gcc inlining too much, and generating _worse_ code as a result (ie inlinging things that were behind an "if (unlikely())" test, and causing the likely path to grow a stack fram and stack spills as a result). So just "O3 inlines more" is not a valid argument. Linus