mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Patrick Oppenlander <patrick.oppenlander@gmail.com>
Cc: musl@lists.openwall.com
Subject: Re: Some questions
Date: Tue, 1 May 2018 17:03:30 -0400	[thread overview]
Message-ID: <20180501210330.GU1392@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAEg67G=RUFOPm25KOG8sfqBMR9J5SaA6Jsvc2XNs4QOTXNq-3w@mail.gmail.com>

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@libc.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.

Rich


  reply	other threads:[~2018-05-01 21:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-30  2:52 Patrick Oppenlander
2018-04-30  3:16 ` Rich Felker
2018-04-30  3:55   ` Patrick Oppenlander
2018-04-30 15:35     ` Rich Felker
2018-05-01  2:35       ` Patrick Oppenlander
2018-05-01 21:03         ` Rich Felker [this message]
2018-05-01 22:14           ` Patrick Oppenlander
2018-04-30  5:17   ` Patrick Oppenlander
2018-04-30 15:29     ` Rich Felker
2018-05-01  2:32       ` Patrick Oppenlander
2018-04-30  5:29   ` Patrick Oppenlander
2018-04-30 15:31     ` Rich Felker
2018-05-01  2:34       ` Patrick Oppenlander
2018-05-01 15:52         ` Rich Felker
2018-05-01 17:35           ` Rich Felker
2018-05-01 21:49             ` Andre McCurdy
2018-05-01 22:14               ` Szabolcs Nagy
2018-05-02 13:42                 ` Rich Felker
2018-05-01  0:10   ` Patrick Oppenlander
2018-05-01 14:19     ` Szabolcs Nagy
2018-05-01 21:05     ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180501210330.GU1392@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=patrick.oppenlander@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).