From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc2b.google.com (mail-oo1-xc2b.google.com [IPv6:2607:f8b0:4864:20::c2b]) by sourceware.org (Postfix) with ESMTPS id 22DE13858D32 for ; Mon, 5 Jun 2023 20:28:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 22DE13858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-55af44f442dso546432eaf.1 for ; Mon, 05 Jun 2023 13:28:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685996897; x=1688588897; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=jl2Oe846Sr0z7nM38LBtDhkOijt/6ebJ1kZP7LVE80w=; b=E4bkhWKaO97NahZ3PLZPrgkwIM8dIV3pAAOw/MvlVukFIJilKkGHXo2lVWDFsjLucn RQkBzL60OJI6Sq4miEtBA9QaSOQF/M5PHc6yNFEuDZHW80T3L40Phq4CNR7a2KAyCY7D H/PulE3t/VTvDyaylcwn3ARRGE8tfSfPaLIz2LNeE28ci9glRkDvJSsus9A4bke1kEAg R6GrOyoRG4qWyjbq8R+pL00fpVmLzQB6hB1QEWOkQQOIa5tLLgMQ+qqLg7dgCED3Xe56 TdpzqSMbPbAj3+EY8rgKdLwiKDdRDDqNMJe8GG7dXYlppAZxgsHDZdLKuX94VSX3NbJm rENg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685996897; x=1688588897; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jl2Oe846Sr0z7nM38LBtDhkOijt/6ebJ1kZP7LVE80w=; b=ikzsVGUhf0GUq0+xgR8nplPAALWtErjcIfCnAnmW9ndXSBpPeI+pr3RVsR2ZDeEiPH NDoN/rsgaakyQT8UuGlfxnfKytDxXfZ9Fq+TLlwqcal1L/l+TK35X/Nc0CaczBsD8vqv ba4Hh2K4YMOBmwJ20iVwB0QBMVuD7hD6pdJ3cAuL+j7hWsd7xTR0dBmwMzGe3GS5F4tV 42fu/fOh5K57L2iSuP2Vg2tQ1d0ex+cIR/0FNh0ycKbgrrKu+dZX7NYw3HmdTdTxvXKh yzSIGJWtYIYNZGwWFHzKhI74B/4k+JskVxY3b0jJz4/mJTeRTZBFRrF276SAQmsVXkcM YVsw== X-Gm-Message-State: AC+VfDwvqGIF2jf0P+6IfzaRzXWwuky5XwqPQ9WmPExE94TtAIRVtJwo NhaJfR62ws4lM9iO9VUs/UOqnVCWTEkilsaobyg= X-Google-Smtp-Source: ACHHUZ5wMP/eyWjP9THdZYRL7pD+TU6iwHMmOx+naaOoP1ad/yzbOn77W7qrFPZFtVdkhEoeVQLe6rty1GXZAHe8vuk= X-Received: by 2002:a4a:d819:0:b0:55a:ecd6:e00e with SMTP id f25-20020a4ad819000000b0055aecd6e00emr82809oov.1.1685996897228; Mon, 05 Jun 2023 13:28:17 -0700 (PDT) MIME-Version: 1.0 References: <20230509031020.3496291-1-goldstein.w.n@gmail.com> In-Reply-To: From: Noah Goldstein Date: Mon, 5 Jun 2023 15:28:05 -0500 Message-ID: Subject: Re: [PATCH v1] x86: Use 64MB as nt-store threshold if no cacheinfo [BZ #30429] To: "H.J. Lu" Cc: libc-alpha@sourceware.org, carlos@systemhalted.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, Jun 5, 2023 at 12:46=E2=80=AFPM H.J. Lu wrote= : > > On Mon, Jun 5, 2023 at 10:15=E2=80=AFAM Noah Goldstein wrote: > > > > On Mon, May 8, 2023 at 10:10=E2=80=AFPM Noah Goldstein 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_feat= ures) > > > reflected in the manual. */ > > > unsigned long int maximum_non_temporal_threshold =3D SIZE_MAX >> 4= ; > > > unsigned long int minimum_non_temporal_threshold =3D 0x4040; > > > + > > > + /* If `non_temporal_threshold` less than `minimum_non_temporal_thr= eshold` > > > + 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 reaso= nable > > > + default bound. 64MB is likely conservative in that most/all sys= tems would > > > + choose a lower value so it should never forcing non-temporal st= ores when > > > + they otherwise wouldn't be used. */ > > > if (non_temporal_threshold < minimum_non_temporal_threshold) > > > - non_temporal_threshold =3D minimum_non_temporal_threshold; > > > + non_temporal_threshold =3D 64 * 1024 * 1024; > > > else if (non_temporal_threshold > maximum_non_temporal_threshold) > > > non_temporal_threshold =3D 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.