public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Noah Goldstein <goldstein.w.n@gmail.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: libc-alpha@sourceware.org, carlos@systemhalted.org
Subject: Re: [PATCH v1] x86: Use 64MB as nt-store threshold if no cacheinfo [BZ #30429]
Date: Mon, 5 Jun 2023 15:28:05 -0500	[thread overview]
Message-ID: <CAFUsyfJM9ObUW6XmUz=3xUiH5RJMn8WUxa6rydq+9u=_4veD4g@mail.gmail.com> (raw)
In-Reply-To: <CAMe9rOprKrNHxZzFiSQbAmTBZm=tFb53XJZAhj5w4Pz5ms2cpg@mail.gmail.com>

On Mon, Jun 5, 2023 at 12:46 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Mon, Jun 5, 2023 at 10:15 AM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
> >
> > On Mon, May 8, 2023 at 10:10 PM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
> > >
> > > If `non_temporal_threshold` is below `minimum_non_temporal_threshold`,
> > > it almost certainly means we failed to read the systems cache info.
> > >
> > > In this case, rather than defaulting the minimum correct value, we
> > > should default to a value that gets at least reasonable
> > > performance. 64MB is chosen conservatively to be at the very high
> > > end. This should never cause non-temporal stores when, if we had read
> > > cache info, we wouldn't have otherwise.
> > > ---
> > >  sysdeps/x86/dl-cacheinfo.h | 10 +++++++++-
> > >  1 file changed, 9 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h
> > > index 864b00a521..6225c852f6 100644
> > > --- a/sysdeps/x86/dl-cacheinfo.h
> > > +++ b/sysdeps/x86/dl-cacheinfo.h
> > > @@ -771,8 +771,16 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)
> > >       reflected in the manual.  */
> > >    unsigned long int maximum_non_temporal_threshold = SIZE_MAX >> 4;
> > >    unsigned long int minimum_non_temporal_threshold = 0x4040;
> > > +
> > > +  /* If `non_temporal_threshold` less than `minimum_non_temporal_threshold`
> > > +     it most likely means we failed to detect the cache info. We don't want
> > > +     to default to `minimum_non_temporal_threshold` as such a small value,
> > > +     while correct, has bad performance. We default to 64MB as reasonable
> > > +     default bound. 64MB is likely conservative in that most/all systems would
> > > +     choose a lower value so it should never forcing non-temporal stores when
> > > +     they otherwise wouldn't be used.  */
> > >    if (non_temporal_threshold < minimum_non_temporal_threshold)
> > > -    non_temporal_threshold = minimum_non_temporal_threshold;
> > > +    non_temporal_threshold = 64 * 1024 * 1024;
> > >    else if (non_temporal_threshold > maximum_non_temporal_threshold)
> > >      non_temporal_threshold = maximum_non_temporal_threshold;
> > >
> > > --
> > > 2.34.1
> > >
> >
> > I want to backport down to 2.28.
> > Thoughts?
>
> Who will use such backport?

People using systems where we miscalculate cache size.
>
> --
> H.J.

      reply	other threads:[~2023-06-05 20:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-09  3:10 Noah Goldstein
2023-05-09  8:56 ` Florian Weimer
2023-05-09 16:01   ` Noah Goldstein
2023-05-11 18:15     ` Noah Goldstein
2023-05-25  8:11     ` Florian Weimer
2023-05-25 18:36 ` H.J. Lu
2023-06-05 17:14 ` Noah Goldstein
2023-06-05 17:45   ` H.J. Lu
2023-06-05 20:28     ` Noah Goldstein [this message]

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='CAFUsyfJM9ObUW6XmUz=3xUiH5RJMn8WUxa6rydq+9u=_4veD4g@mail.gmail.com' \
    --to=goldstein.w.n@gmail.com \
    --cc=carlos@systemhalted.org \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).