linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	"gcc@gcc.gnu.org" <gcc@gcc.gnu.org>,
	parallel@lists.isocpp.org, llvm-dev@lists.llvm.org,
	Will Deacon <will.deacon@arm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	David Howells <dhowells@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com>,
	Luc Maranget <luc.maranget@inria.fr>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jade Alglave <j.alglave@ucl.ac.uk>,
	Ingo Molnar <mingo@kernel.org>
Subject: Re: [isocpp-parallel] Proposal for new memory_order_consume definition
Date: Sun, 28 Feb 2016 08:13:51 -0800	[thread overview]
Message-ID: <CA+55aFyauwKmUdxfrKcy5Q2kvdej5fWt6xL+amVyPFhzmHMcsg@mail.gmail.com> (raw)
In-Reply-To: <20160228082702.GA300@x4>

On Sun, Feb 28, 2016 at 12:27 AM, Markus Trippelsdorf
<markus@trippelsdorf.de> wrote:
>> >
>> >   -fno-strict-overflow
>>
>>   -fno-strict-aliasing.
>
> Do not forget -fno-delete-null-pointer-checks.
>
> So the kernel obviously is already using its own C dialect, that is
> pretty far from standard C.
> All these options also have a negative impact on the performance of the
> generated code.

They really don't.

Have you ever seen code that cared about signed integer overflow?
Yeah, getting it right can make the compiler generate an extra ALU
instruction once in a blue moon, but trust me - you'll never notice.
You *will* notice when you suddenly have a crash or a security issue
due to bad code generation, though.

The idiotic C alias rules aren't even worth discussing. They were a
mistake. The kernel doesn't use some "C dialect pretty far from
standard C". Yeah, let's just say that the original C designers were
better at their job than a gaggle of standards people who were making
bad crap up to make some Fortran-style programs go faster.

They don't speed up normal code either, they just introduce undefined
behavior in a lot of code.

And deleting NULL pointer checks because somebody made a mistake, and
then turning that small mistake into a real and exploitable security
hole? Not so smart either.

The fact is, undefined compiler behavior is never a good idea. Not for
serious projects.

Performance doesn't come from occasional small and odd
micro-optimizations. I care about performance a lot, and I actually
look at generated code and do profiling etc. None of those three
options have *ever* shown up as issues. But the incorrect code they
generate? It has.

     Linus

  parent reply	other threads:[~2016-02-28 16:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18  1:10 Proposal for new memory_order_consume definition Paul E. McKenney
2016-02-20  2:15 ` [isocpp-parallel] " Tony V E
2016-02-20 19:53   ` Paul E. McKenney
2016-02-26  0:46     ` Hans Boehm via llvm-dev
2016-02-26 23:56       ` Lawrence Crowl
2016-02-27 17:06       ` Paul E. McKenney
2016-02-27 19:16         ` Linus Torvalds via llvm-dev
2016-02-27 23:10           ` Paul E. McKenney via llvm-dev
2016-02-27 23:10             ` Paul E. McKenney
2016-02-28  8:27             ` Markus Trippelsdorf via llvm-dev
2016-02-28  8:27               ` Markus Trippelsdorf
2016-02-28 16:13               ` Linus Torvalds [this message]
2016-02-28 16:50                 ` via llvm-dev
2016-02-28 16:50                   ` [llvm-dev] " cbergstrom
2016-02-29 17:37                 ` Michael Matz
2016-02-29 17:57                   ` Linus Torvalds via llvm-dev
2016-02-29 17:57                     ` Linus Torvalds
2016-02-29 19:38                 ` Lawrence Crowl
2016-02-29 21:10                   ` James Y Knight via llvm-dev
2016-02-29 21:12                   ` James Y Knight via llvm-dev
2016-02-29 21:12                     ` [llvm-dev] " James Y Knight
2016-02-29 20:45                 ` Toon Moene
2016-02-29 20:45                   ` Toon Moene
2016-02-29 18:17         ` Michael Matz
2016-03-01  1:28           ` Paul E. McKenney via llvm-dev
2016-03-01  1:28             ` Paul E. McKenney

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=CA+55aFyauwKmUdxfrKcy5Q2kvdej5fWt6xL+amVyPFhzmHMcsg@mail.gmail.com \
    --to=torvalds@linux-foundation.org \
    --cc=Ramana.Radhakrishnan@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=j.alglave@ucl.ac.uk \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm-dev@lists.llvm.org \
    --cc=luc.maranget@inria.fr \
    --cc=markus@trippelsdorf.de \
    --cc=mingo@kernel.org \
    --cc=parallel@lists.isocpp.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=will.deacon@arm.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).