[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <042668BD-8912-44D4-9CA1-9ABA2F094709@vmware.com>
Date: Tue, 1 May 2018 16:39:09 +0000
From: Nadav Amit <namit@...are.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
CC: Josh Poimboeuf <jpoimboe@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: Suboptimal inline heuristics due to non-code sections
Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> On Tue, May 1, 2018 at 6:40 AM Josh Poimboeuf <jpoimboe@...hat.com> wrote:
>
>> But if I remove the section completely by removing the
>> pushsection/popsection, then copy_overflow() gets inlined.
>
>> So GCC's inlining decisions are somehow influenced by the existence of
>> some random empty section. This definitely seems like a GCC bug to me.
>
> I think gcc uses the size of the string to approximate the size of an
> inline asm.
>
> So I don't think it's the "empty section" that makes gcc do this, I think
> it's literally "our inline asms _look_ big”.
I didn’t think about that.
Playing with the code a bit more, it seems that it is actually related to
the number of “new-lines” in the inline assembly. Removing 4 new-lines from
_BUG_FLAGS (those that can be removed without breaking assembly) eliminated
most of the non-inlined versions of copy_overflow().
Would it be reasonable to remove new-lines in such cases?
Regards,
Nadav
Powered by blists - more mailing lists