[PATCH] x86: Add thresholds for "rep movsb/stosb" to tunables

H.J. Lu hjl.tools@gmail.com
Mon Jun 1 19:32:50 GMT 2020


On Fri, May 29, 2020 at 9:18 AM Carlos O'Donell <carlos@redhat.com> wrote:
>
> On 5/29/20 9:21 AM, H.J. Lu wrote:
> > On Fri, May 29, 2020 at 6:13 AM Carlos O'Donell <carlos@redhat.com> wrote:
> >>
> >> On 5/23/20 12:37 AM, H.J. Lu via Libc-alpha wrote:
> >>> There is no single threshold value which is good for all workloads.
> >>> I don't think we should change REP_STOSB_THRESHOLD to 1MB.
> >>> On the other hand, the fixed threshold isn't flexible.  Please try this
> >>> patch to see if you can set the threshold for your specific workload.
> >>
> >> My request here is that the manual include a documentation of what the
> >> minimums are for the tunable. Even an example reference of the minimum
> >> value would be useful for the tunable e.g. On AVX512 systems this value
> >> is X, on AVX systems this value is Y, on all other systems Z.
> >>
> >
> > The logic of thresholds are:
> >
> >  /* NB: The REP MOVSB threshold must be greater than VEC_SIZE * 8.  */
> >   unsigned int minimum_rep_movsb_threshold;
> >   /* NB: The default REP MOVSB threshold is 2048 * (VEC_SIZE / 16).  */
> >   unsigned int rep_movsb_threshold;
> >   if (CPU_FEATURES_ARCH_P (cpu_features, AVX512F_Usable)
> >       && !CPU_FEATURES_ARCH_P (cpu_features, Prefer_No_AVX512))
> >     {
> >       rep_movsb_threshold = 2048 * (64 / 16);
> >       minimum_rep_movsb_threshold = 64 * 8;
> >     }
> >   else if (CPU_FEATURES_ARCH_P (cpu_features,
> > AVX_Fast_Unaligned_Load))
> >     {
> >       rep_movsb_threshold = 2048 * (32 / 16);
> >       minimum_rep_movsb_threshold = 32 * 8;
> >     }
> >   else
> >     {
> >       rep_movsb_threshold = 2048 * (16 / 16);
> >       minimum_rep_movsb_threshold = 16 * 8;
> >     }
> >   if (cpu_features->rep_movsb_threshold > minimum_rep_movsb_threshold)
> >     __x86_rep_movsb_threshold = cpu_features->rep_movsb_threshold;
> >   else
> >     __x86_rep_movsb_threshold = rep_movsb_threshold;
> >
> > We can't simply say AVX512 machines will use ZMM and AVX machines
> > will use YMM.  It depends on other factors which are invisible to users.
> > Can you suggest some paragraph for libc manual?
>
> We must tell the users the lower limit, so they can avoid having their
> settings ignored.
>
> If we can't tell them the lower limit in the manual, then we must add
> a way to print it.
>
> Augment the libc.so.6 main() entry point to print all tunables with
> a --list-tunables option and print the limit? Then in the manual just

Did you mean adding  --list-tunables to ld.so?  libc.so.6 doesn't take
any arguments.

> say you have to look it up?
>
> --
> Cheers,
> Carlos.
>


-- 
H.J.


More information about the Libc-alpha mailing list