Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2201042imm; Fri, 7 Sep 2018 12:23:01 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaB13wBwXho4wCbnnPQ6lAziUaFORtXfOlRmrCC/fGRl3E9isncVetIL1hpTKTGm7i271UC X-Received: by 2002:a62:438f:: with SMTP id l15-v6mr10450930pfi.196.1536348180982; Fri, 07 Sep 2018 12:23:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536348180; cv=none; d=google.com; s=arc-20160816; b=ugjFZQczenaF6AUskCNuRTiL2CVlrfMlXqHgbc1kCfY5d7Yw+hmjzsIRQjYRAFZNvj MIRvf28r0omPO8u/xqkcUrZmFNwmTpbE9jh63skDL4kv3MOtK1xjbf8iGT7utNtwFDOp 6LpaZT9Ov4zefM8AyLsMbS/L7rRMwTxjMFvcqXYE/wcXf1MIrcPfA0vzuHpuFMaBDMuI Mu39OhKKGSreu9+pMhCXeZ/ZYVYUa3FE04toSvJ6cW4ye/NSgDBbPBYwQ72x6XFYpJkh r2m/BDRjpT2jpveQi9AF6QtKxXBZQoV3LdI4rs9R8+MhwwGTcnJqlnF1vSOmzUf7ZVAU 5LXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=fiSXZ5eqSPgdJjD50E/ZwJ7lpkclOGU9P+fStImj3/c=; b=RTvutbllbLIe0Zj/DwVIN1FHTvNcBIzMtjNEl+MFyC06bBwCjPnMbk6VmtOWDWU5gS hApQfy1fSDVZnDYvMDgDZvtozxejUbpxJBWQRSpH6V9th0dPG28Z9hFyFy3TP2vOThlU ISAQ7EaKihvO+FmhLz7QwzKDn5cSiVJEtXE2i1nZgh1aWKWG1Zd+JItcVoywlTuAgKdW gVWoF85L3BbInDmiNu4pnkBegoQdA5yjgHQXq5a0EoryfQ+9Rjl4cMCrmg8ZHdE7G6TZ eihymgUW/jtMfVLHfhtsoU9/1m8MTl2fZMtMfzz5L/zJ7+y4AUXAEmbCARTzd1MVeXOa bRNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SH7WOGyF; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z4-v6si9523639pgo.626.2018.09.07.12.22.44; Fri, 07 Sep 2018 12:23:00 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SH7WOGyF; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726354AbeIHADv (ORCPT + 99 others); Fri, 7 Sep 2018 20:03:51 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:35990 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725987AbeIHADu (ORCPT ); Fri, 7 Sep 2018 20:03:50 -0400 Received: by mail-lj1-f193.google.com with SMTP id v26-v6so13132017ljj.3; Fri, 07 Sep 2018 12:21:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=fiSXZ5eqSPgdJjD50E/ZwJ7lpkclOGU9P+fStImj3/c=; b=SH7WOGyFtPFQd7I5m4as3CP14CNHtF1xa8YrmJofUFPMGabFY/igwMivZi7t+/bzwq ltXmSQtIgTXLKI4XXboWVTh3No7RSMbRPSDvOFpxeAjmIUq96cAhffvzwjlQPkydWruQ A+kefXok1eSVh0By5NV8KhIjkjUvnBMYhEXVBitKTMRCIUglwX2ZKnPW9iHInHHkjyo/ CQEd3ThQHxo4FeQ7xs0PSTqGeDPV4rPeko3v3ca6d9sd2KnQPDv5+wSqETwWCC+uv15J 8C0HukSRm8obJRa5zIKuwKMHbr1CqwQkUA7NRqqoAO64N7pwMBKncGbjAfI+24qIsey8 FDfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=fiSXZ5eqSPgdJjD50E/ZwJ7lpkclOGU9P+fStImj3/c=; b=Z9C42bNvHpRuIjbEwJCsaTLiZOaYtCo+/CObyswYjGesekhd0NTZizCoj010LsJoBp e8N+k+UD/iGe5SocTRcKFCkg4wUJq0kyRjBzB6z5LW975vi3NSaoVUi5NlCj46q9ww6/ 3ZpAs6Iz/tJZTcddbi9pr+b/HyTKmzXkxx9tvvNO4JIRUY3dLAqjrCqdVEs0aJJBOapT hrMeMZPISkEbxfqPCKeNSfQSB90rimaYHZKnKBncofwjPfFCc7NINXnwD6FHyp4j7wld /5W70VIXMrVlHPEzzALeh/yuq40BWKJysfAwyOevleOS7o4n2iV4MLldpPRRekLSPTIv obLg== X-Gm-Message-State: APzg51AzwuK5G9527MJWQO+XC2S9Q0PbSca5Xu8cOKKYu4tTQT2fmkVU vr/NPXoaD/1jKizhHfI3CqI= X-Received: by 2002:a2e:9b04:: with SMTP id u4-v6mr5693723lji.78.1536348088152; Fri, 07 Sep 2018 12:21:28 -0700 (PDT) Received: from Mort.jumbo.freeair (91-156-179-220.elisa-laajakaista.fi. [91.156.179.220]) by smtp.gmail.com with ESMTPSA id f9-v6sm1417748ljf.9.2018.09.07.12.21.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Sep 2018 12:21:27 -0700 (PDT) From: Igor Stoppa X-Google-Original-From: Igor Stoppa To: Arnd Bergmann Cc: igor.stoppa@gmail.com, Igor Stoppa , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] asm-generic: bug: add unlikely() to BUG_ON() Date: Fri, 7 Sep 2018 22:21:19 +0300 Message-Id: <20180907192119.4931-1-igor.stoppa@huawei.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a hint to the compiler. If BUG_ON() is used instead of BUG(), it means that probably the preferred outcome is to not BUG(). The optimization is disabled, in case CONFIG_PROFILE_ANNOTATED_BRANCHES is turned on. Signed-off-by: Igor Stoppa Cc: Arnd Bergmann Cc: linux-arch@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- include/asm-generic/bug.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 20561a60db9c..bf47584eab2a 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -183,7 +183,11 @@ void __warn(const char *file, int line, void *caller, unsigned taint, #endif #ifndef HAVE_ARCH_BUG_ON +#ifdef CONFIG_PROFILE_ANNOTATED_BRANCHES #define BUG_ON(condition) do { if (condition) BUG(); } while (0) +#else +#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) +#endif #endif #ifndef HAVE_ARCH_WARN_ON -- 2.17.1