Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 2 May 2018 08:14:33 +1000
From: Patrick Oppenlander <patrick.oppenlander@...il.com>
Cc: musl@...ts.openwall.com
Subject: Re: Some questions

On Wed, May 2, 2018 at 7:03 AM, Rich Felker <dalias@...c.org> wrote:
> On Tue, May 01, 2018 at 12:35:58PM +1000, Patrick Oppenlander wrote:
>> On Tue, May 1, 2018 at 1:35 AM, Rich Felker <dalias@...c.org> wrote:
>> > On Mon, Apr 30, 2018 at 01:55:16PM +1000, Patrick Oppenlander wrote:
>> >> I was talking about the case of a uniprocessor system running a multi
>> >> theaded process.
>> >>
>> >> In that case the "spin" part of spinlock just burns time & electrons.
>> >> The "lock" part obviously can't be omitted. Calling straight through
>> >> to the kernel is the most efficient thing to do.
>> >
>> > I see. Is this an issue you've actually hit? I don't see any obvious
>> > way to make this decision at runtime that doesn't incur unwanted costs
>> > or failure modes, and I suspect we're spinning way too many times
>> > anyway even for SMP (i.e. the ideal solution might just be
>> > significantly reducing the # of spins).
>>
>> I haven't measured the performance impact of it.
>>
>> One option could be to configure the number of spins at compile time
>> and set to zero for known uniprocessor architectures (like armv7m). Or
>> have a configure override. Really this is just performance tuning,
>> there's no danger of generating incorrect code.
>>
>> I can't find a way of detecting a SMP kernel other than parsing the
>> result of uname(2) which sucks. I was hoping there might be something
>> in auxv hwcap.
>
> There doesn't seem to be any good way. Unless you find this is a real
> performance bottleneck for you, I'd like to punt on it for now and
> come back when someone has time to do real research on number of spins
> that make sense and whether the number is low enough not to care for
> non-SMP.

No problem.

Patrick

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.