From: David Miller <davem@davemloft.net>
To: alexei.starovoitov@gmail.com
Cc: alexander.levin@verizon.com, devtimhansen@gmail.com,
willemb@google.com, edumazet@google.com, soheil@google.com,
pabeni@redhat.com, elena.reshetova@intel.com, tom@quantonium.net,
Jason@zx2c4.com, fw@strlen.de, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] net/core: Fix BUG to BUG_ON conditionals.
Date: Mon, 09 Oct 2017 16:17:08 -0700 (PDT) [thread overview]
Message-ID: <20171009.161708.963726434970115075.davem@davemloft.net> (raw)
In-Reply-To: <20171009230618.e5gla2iuqwmndkig@ast-mbp>
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Date: Mon, 9 Oct 2017 16:06:20 -0700
>> For these archs, wouldn't it then be more efficient to use BUG_ON
>> rather than BUG()?
>
> why more efficient? any data to prove that?
It can completely eliminate a branch.
For example on powerpc if you use BUG() then the code generated is:
test condition
branch_not_true 1f
unconditional_trap
1:
Whereas with BUG_ON() it's just:
test condition
trap_if_true
Which is a lot better even when the branches in the first case are
well predicted.
next prev parent reply other threads:[~2017-10-09 23:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-09 15:37 [PATCH v2] net/core: Fix BUG to BUG_ON conditionals Tim Hansen
2017-10-09 17:15 ` Alexei Starovoitov
2017-10-09 20:26 ` Levin, Alexander (Sasha Levin)
2017-10-09 23:06 ` Alexei Starovoitov
2017-10-09 23:15 ` Levin, Alexander (Sasha Levin)
2017-10-09 23:23 ` Alexei Starovoitov
2017-10-10 1:14 ` Levin, Alexander (Sasha Levin)
2017-10-09 23:17 ` David Miller [this message]
2017-10-10 19:32 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2017-10-08 19:17 [PATCH] " Tim Hansen
2017-10-08 20:03 ` [PATCH v2] " Tim Hansen
2017-10-09 4:20 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171009.161708.963726434970115075.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=Jason@zx2c4.com \
--cc=alexander.levin@verizon.com \
--cc=alexei.starovoitov@gmail.com \
--cc=devtimhansen@gmail.com \
--cc=edumazet@google.com \
--cc=elena.reshetova@intel.com \
--cc=fw@strlen.de \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=soheil@google.com \
--cc=tom@quantonium.net \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).