Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2114669yba; Wed, 3 Apr 2019 01:23:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9vrEaSv+RAS5CsWl/KhMPVe3KCLf8HiqUDYe9yn0/ezbJGLhOZTaDrr5W+3PwtS4xBI7E X-Received: by 2002:a63:d302:: with SMTP id b2mr10856959pgg.13.1554279803194; Wed, 03 Apr 2019 01:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554279803; cv=none; d=google.com; s=arc-20160816; b=hJcpvjm2/S2yW1fDfLw8xNvkpXhlXIMxEnqLCFfRuCTa8dop96faln8IT3fflt4WZs S79ucgZBnlqZABV/nB4VjwvQ3sMBq/WUuV9P9uTfq1w2wZB/tIqaBii+xT2u7HqR/cvU m/md8D1TAh8XjO8aPgqMnJsoJT38znzlu8M3ADsqIvoQG3ni5+6vFCXf9S3N4GTDTTwI xu6fofGbmB734UmvmAQN9Qtnb4HHd8r+x0KIQRnOlMx1AqvD7PajiGe7eU5zp93MBHWV sr98hYhSmwceeKpHT533eyN0dfO9dIKibgHS5XW2pMKWv0R/A3Oe97QXvtfTB3GZnPBn igJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=FewWffJzVdtfQE7MeQBCmgsGpzUjq9L9ItheTOyxkhE=; b=kQBiHj2t2bMkaVDrdTw+EqyMBRu6sV4Ce3soO7+8Tve2TrdeMU1dlQqmzc7k/Ev13v mNpXK3xi5MMtKaKFXoHbi3dCpg7+IMe/xNcTBMbfNVXfhcKEPrFEkH7n9q0NSHe+4xD5 htCxiFp6nA95YoKK0z4shSTV3CjSKJOF7dPMT74nsJF6GOr9TXweQLSoqHq8YrAKqutk ZFsK6q+N0bdjOer8E2C15RqbPdPk1QrXC++4PcP1DR1ScQDRRlFfReRjSw90Jvbc82N0 y4LmcpIQA/vC/HlIOjLp8DOmoffnFzjgXuJq4KhS76aA/Mz/D1Fw6anaGUEUQBWxLGgW ki+g== 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 w11si4495469plz.403.2019.04.03.01.23.07; Wed, 03 Apr 2019 01:23:23 -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 S1728782AbfDCIWQ (ORCPT + 99 others); Wed, 3 Apr 2019 04:22:16 -0400 Received: from terminus.zytor.com ([198.137.202.136]:32983 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726004AbfDCIWQ (ORCPT ); Wed, 3 Apr 2019 04:22:16 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x338LoeX1758688 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 3 Apr 2019 01:21:50 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x338Lno91758685; Wed, 3 Apr 2019 01:21:49 -0700 Date: Wed, 3 Apr 2019 01:21:49 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Josh Poimboeuf Message-ID: Cc: peterz@infradead.org, hpa@zytor.com, torvalds@linux-foundation.org, jpoimboe@redhat.com, linux-kernel@vger.kernel.org, mingo@kernel.org, bp@alien8.de, tglx@linutronix.de Reply-To: linux-kernel@vger.kernel.org, bp@alien8.de, tglx@linutronix.de, mingo@kernel.org, jpoimboe@redhat.com, torvalds@linux-foundation.org, peterz@infradead.org, hpa@zytor.com In-Reply-To: <20190307174802.46fmpysxyo35hh43@treble> References: <20190307174802.46fmpysxyo35hh43@treble> To: linux-tip-commits@vger.kernel.org Subject: [tip:core/objtool] tracing: Improve "if" macro code generation Git-Commit-ID: 37686b1353cfc30e127cef811959cdbcd0495d98 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=0.3 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_12_24 autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 37686b1353cfc30e127cef811959cdbcd0495d98 Gitweb: https://git.kernel.org/tip/37686b1353cfc30e127cef811959cdbcd0495d98 Author: Josh Poimboeuf AuthorDate: Thu, 7 Mar 2019 11:48:02 -0600 Committer: Ingo Molnar CommitDate: Wed, 3 Apr 2019 09:36:27 +0200 tracing: Improve "if" macro code generation With CONFIG_PROFILE_ALL_BRANCHES=y, the "if" macro converts the conditional to an array index. This can cause GCC to create horrible code. When there are nested ifs, the generated code uses register values to encode branching decisions. Make it easier for GCC to optimize by keeping the conditional as a conditional rather than converting it to an integer. This shrinks the generated code quite a bit, and also makes the code sane enough for objtool to understand. Reported-by: Peter Zijlstra Signed-off-by: Josh Poimboeuf Signed-off-by: Peter Zijlstra (Intel) Cc: Borislav Petkov Cc: Linus Torvalds Cc: Thomas Gleixner Cc: brgerst@gmail.com Cc: catalin.marinas@arm.com Cc: dvlasenk@redhat.com Cc: dvyukov@google.com Cc: hpa@zytor.com Cc: james.morse@arm.com Cc: julien.thierry@arm.com Cc: luto@amacapital.net Cc: luto@kernel.org Cc: rostedt@goodmis.org Cc: valentin.schneider@arm.com Cc: will.deacon@arm.com Link: https://lkml.kernel.org/r/20190307174802.46fmpysxyo35hh43@treble Signed-off-by: Ingo Molnar --- include/linux/compiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 445348facea9..d58aa0db05f9 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -67,7 +67,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, .line = __LINE__, \ }; \ ______r = !!(cond); \ - ______f.miss_hit[______r]++; \ + ______r ? ______f.miss_hit[1]++ : ______f.miss_hit[0]++;\ ______r; \ })) #endif /* CONFIG_PROFILE_ALL_BRANCHES */