Re: Suboptimal inline heuristics due to non-code sections

2018-05-01 Thread Nadav Amit
Linus Torvalds wrote: > On Tue, May 1, 2018 at 9:46 AM Nadav Amit wrote: > >> My bad. It’s not the new-line. Let me do some more digging. > > From the gcc docs: > > Some targets require that GCC track the size of each instruction used > in

Re: Suboptimal inline heuristics due to non-code sections

2018-05-01 Thread Nadav Amit
Linus Torvalds wrote: > On Tue, May 1, 2018 at 9:46 AM Nadav Amit wrote: > >> My bad. It’s not the new-line. Let me do some more digging. > > From the gcc docs: > > Some targets require that GCC track the size of each instruction used > in order to generate correct code. Because the

Re: Suboptimal inline heuristics due to non-code sections

2018-05-01 Thread Linus Torvalds
On Tue, May 1, 2018 at 9:46 AM Nadav Amit wrote: > My bad. It’s not the new-line. Let me do some more digging. From the gcc docs: Some targets require that GCC track the size of each instruction used in order to generate correct code. Because the final length of the

Re: Suboptimal inline heuristics due to non-code sections

2018-05-01 Thread Linus Torvalds
On Tue, May 1, 2018 at 9:46 AM Nadav Amit wrote: > My bad. It’s not the new-line. Let me do some more digging. From the gcc docs: Some targets require that GCC track the size of each instruction used in order to generate correct code. Because the final length of the code produced by

Re: Suboptimal inline heuristics due to non-code sections

2018-05-01 Thread Linus Torvalds
On Tue, May 1, 2018 at 9:39 AM Nadav Amit wrote: > Would it be reasonable to remove new-lines in such cases? Yeah, that may be fine for some of our (already illegible) section crud. Linus

Re: Suboptimal inline heuristics due to non-code sections

2018-05-01 Thread Linus Torvalds
On Tue, May 1, 2018 at 9:39 AM Nadav Amit wrote: > Would it be reasonable to remove new-lines in such cases? Yeah, that may be fine for some of our (already illegible) section crud. Linus

Re: Suboptimal inline heuristics due to non-code sections

2018-05-01 Thread Nadav Amit
Nadav Amit wrote: > Linus Torvalds wrote: > >> On Tue, May 1, 2018 at 6:40 AM Josh Poimboeuf wrote: >> >>> But if I remove the section completely by removing the >>> pushsection/popsection, then copy_overflow() gets

Re: Suboptimal inline heuristics due to non-code sections

2018-05-01 Thread Nadav Amit
Nadav Amit wrote: > Linus Torvalds wrote: > >> On Tue, May 1, 2018 at 6:40 AM Josh Poimboeuf 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

Re: Suboptimal inline heuristics due to non-code sections

2018-05-01 Thread Nadav Amit
Linus Torvalds wrote: > On Tue, May 1, 2018 at 6:40 AM Josh Poimboeuf wrote: > >> But if I remove the section completely by removing the >> pushsection/popsection, then copy_overflow() gets inlined. > >> So GCC's inlining decisions are

Re: Suboptimal inline heuristics due to non-code sections

2018-05-01 Thread Nadav Amit
Linus Torvalds wrote: > On Tue, May 1, 2018 at 6:40 AM Josh Poimboeuf 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

Re: Suboptimal inline heuristics due to non-code sections

2018-05-01 Thread Linus Torvalds
On Tue, May 1, 2018 at 6:40 AM Josh Poimboeuf 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.

Re: Suboptimal inline heuristics due to non-code sections

2018-05-01 Thread Linus Torvalds
On Tue, May 1, 2018 at 6:40 AM Josh Poimboeuf 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

Re: Suboptimal inline heuristics due to non-code sections

2018-05-01 Thread Josh Poimboeuf
On Tue, May 01, 2018 at 06:50:14AM +, Nadav Amit wrote: > When gcc considers the size of a function for inlining decisions, it > apparently considers *all* sections. Since the kernel extensively uses > sections for things other than code (e.g., exception-table, bug-table), the > optimality of

Re: Suboptimal inline heuristics due to non-code sections

2018-05-01 Thread Josh Poimboeuf
On Tue, May 01, 2018 at 06:50:14AM +, Nadav Amit wrote: > When gcc considers the size of a function for inlining decisions, it > apparently considers *all* sections. Since the kernel extensively uses > sections for things other than code (e.g., exception-table, bug-table), the > optimality of

Suboptimal inline heuristics due to non-code sections

2018-05-01 Thread Nadav Amit
When gcc considers the size of a function for inlining decisions, it apparently considers *all* sections. Since the kernel extensively uses sections for things other than code (e.g., exception-table, bug-table), the optimality of these decisions seem questionable to me. The objtool’s sections may

Suboptimal inline heuristics due to non-code sections

2018-05-01 Thread Nadav Amit
When gcc considers the size of a function for inlining decisions, it apparently considers *all* sections. Since the kernel extensively uses sections for things other than code (e.g., exception-table, bug-table), the optimality of these decisions seem questionable to me. The objtool’s sections may