This is the mail archive of the
mailing list for the binutils project.
Re: Gold linker patch to split unlikely text into a separate segment
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Sriraman Tallam <tmsriram at google dot com>
- Cc: Cary Coutant <ccoutant at gmail dot com>, Krzysztof Pszeniczny <kpszeniczny at google dot com>, Chris Kennelly <ckennelly at google dot com>, Xinliang David Li <davidxl at google dot com>, Stephane Eranian <eranian at google dot com>, binutils <binutils at sourceware dot org>
- Date: Thu, 5 Oct 2017 16:41:05 -0700
- Subject: Re: Gold linker patch to split unlikely text into a separate segment
- Authentication-results: sourceware.org; auth=none
- References: <CAAs8HmxCpQrbpw8YTLx6zGhTn5XqEp_TBn5_h7v4wTwSHQsQPg@mail.gmail.com> <CAMe9rOpjtiGPQ=zLB4kFgBfamusoYv1ZGkUgnEqt5N+FmiL1_A@mail.gmail.com> <CAAs8Hmx6-TAV5UVjYKzLL70=E=5xWMCb-g6db3EPa=uzMwxFemail@example.com>
On 10/5/17, Sriraman Tallam <firstname.lastname@example.org> wrote:
> On Wed, Oct 4, 2017 at 5:12 PM, H.J. Lu <email@example.com> wrote:
>> On 10/4/17, Sriraman Tallam <firstname.lastname@example.org> wrote:
>>> This patch adds an option to gold to create a new ELF segment for
>>> code determined unlikely by the compiler. Currently, this can be done
>>> with a linker plugin but I was wondering if it is fine to have this
>>> support in gold with an option for ease of use.
>>> The advantages of doing this are:
>>> * We could only map the hot segment to huge pages to keep iTLB misses
>>> * We could munlock the unlikely segment
>>> Is this alright?
>>> ChangeLog entry:
>>> * options.h (text_unlikely_segment): New option.
>>> * layout.cc (Layout::layout): Create new output section
>>> for .text.unlikely sections with the new option.
>>> (Layout::segment_precedes): Check for the new option
>>> when segment flags match.
>>> Patch attached.
>> This is an interesting approach. Do you have some performace
> With function re-ordering of hot code, segment splitting and mapping
> only hot code to huge pages, we see a reduction in iTLB misses
> translating to performance improvements of 0.5 to 1% on some of our
Please include this info in your commit log.
>> 2 Comments:
>> 1. I'd prefer "-z text-unlikely-segment" with '-', instead of '_'.
>> 2. Need a testcase.
> Done and patch attached.
LGTM. But I can't approve it.