[PATCH] Set -fprofile-update=atomic when -pthread is present

Martin Liška mliska@suse.cz
Tue Oct 4 12:05:00 GMT 2016

On 10/03/2016 02:26 PM, Nathan Sidwell wrote:
> On 10/03/16 08:13, Martin Liška wrote:
>> On 08/18/2016 05:53 PM, Jeff Law wrote:
>>> On 08/18/2016 09:51 AM, Andi Kleen wrote:
>>>>> I'd prefer to make updates atomic in multi-threaded applications.
>>>>> The best proxy we have for that is -pthread.
>>>>> Is it slower, most definitely, but odds are we're giving folks
>>>>> garbage data otherwise, which in many ways is even worse.
>>>> It will likely be catastrophically slower in some cases.
>>>> Catastrophically as in too slow to be usable.
>>>> An atomic instruction is a lot more expensive than a single increment. Also
>>>> they sometimes are really slow depending on the state of the machine.
>>> And for those cases there's a way to override.
>>> The default should be set for correctness.
>>> jeff
>> I would to somehow resolve the discussion related to default value selection.
>> Is the prevailing consensus that we should set -fprofile-update=atomic when
>> -pthread is set? If so, I'll prepare a patch. I tend to do it this way.
> This is my preference.
> nathan

Ok, this is final version of patch which implements both the warning and appending -fprofile-update
to a command line options.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-fprofile-update-option-juggling.patch
Type: text/x-patch
Size: 1254 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20161004/f4dabcb5/attachment.bin>

More information about the Gcc-patches mailing list