From patchwork Fri Aug 11 02:50:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noah Goldstein X-Patchwork-Id: 1820101 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=MQWIKBNm; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RMSvw5M7Vz1yf2 for ; Fri, 11 Aug 2023 12:50:35 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7AFD83858CD1 for ; Fri, 11 Aug 2023 02:50:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7AFD83858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1691722233; bh=SZILiyBQQYUo8GoAd5IBY6HyEJaeOgksY9jBvrLKnpw=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=MQWIKBNm8xJ3Ej45wxeXW6RfIxNjEfpdYroON5kE6a/JpvSyq7BalD0B5HF2nO3r1 B11UxY8qXvA+QBY/6n/vQ26nvBgiT6J8t/J5h3hqpto9Yz4ddkhWG1wNUOjkWMv1h6 f7UbRlY8yPkEb/+zP9iwweTfz0kMqqiZoYbxfiMA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id 32C523858D20 for ; Fri, 11 Aug 2023 02:50:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 32C523858D20 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-99cdb0fd093so218979266b.1 for ; Thu, 10 Aug 2023 19:50:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691722216; x=1692327016; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SZILiyBQQYUo8GoAd5IBY6HyEJaeOgksY9jBvrLKnpw=; b=g97228soKT7+ZkyPuyhx01eqizlIRpRifidXtwwUaL5RwK8cs8t2zaJ4fY+yJAkap/ 2e2ww5hc2GmizAzLqko0BIaJunRqVdajSzX9qQNd9hQiW7GH2RQgB4cHqWPLdF5Ws6X6 9Hemc3IqOZRLQd7vMntO0uO4BdZoLCkgU8VeaKp8g/3A4q6JXdFz8NxktLVqAB8xPzFa J3admmbAYx1evJ/PwWiu+ZGqGfbaSIJJCfOQvmpRtVo+NkGD4ua7Vswp0WsKVmDS4sfa I0MsXIv9Gu7hLgu4LDsxxMP/Igw4PRtsNSmUQXaP8QtpNHyhBMAeMKZOO9s7i2D4RI8x 4H8w== X-Gm-Message-State: AOJu0YyqDVigHtvxsbq1f5S7AeZ+W0g695riZOqBpyKuTg4/Fq/cyG1V rkQ+S5BkWRGpm+wl/ZMPej1jJOT/sUY= X-Google-Smtp-Source: AGHT+IESKPNBzWFpGNaD/N7EdzJzA5nj0giLWJ89TcXHlGmUpSxlWj+++cvTUrHoNr6o++e1CCxvrw== X-Received: by 2002:a17:906:101b:b0:99b:de31:6666 with SMTP id 27-20020a170906101b00b0099bde316666mr623140ejm.22.1691722216185; Thu, 10 Aug 2023 19:50:16 -0700 (PDT) Received: from noahgold-DESK.intel.com ([192.55.55.58]) by smtp.gmail.com with ESMTPSA id qn17-20020a170907211100b00992b510089asm1666332ejb.84.2023.08.10.19.50.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 19:50:15 -0700 (PDT) To: libc-alpha@sourceware.org Cc: goldstein.w.n@gmail.com, hjl.tools@gmail.com, carlos@systemhalted.org Subject: [PATCH v2] x86: Fix incorrect scope of setting `shared_per_thread` [BZ# 30745] Date: Thu, 10 Aug 2023 21:50:01 -0500 Message-Id: <20230811025001.3692906-1-goldstein.w.n@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230811003109.3046769-1-goldstein.w.n@gmail.com> References: <20230811003109.3046769-1-goldstein.w.n@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.1 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 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Noah Goldstein via Libc-alpha From: Noah Goldstein Reply-To: Noah Goldstein Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" The: ``` if (shared_per_thread > 0 && threads > 0) shared_per_thread /= threads; ``` Code was accidentally moved to inside the else scope. This doesn't match how it was previously (before af992e7abd). This patch fixes that by putting the division after the `else` block. --- sysdeps/x86/dl-cacheinfo.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h index 285773039f..88316a7818 100644 --- a/sysdeps/x86/dl-cacheinfo.h +++ b/sysdeps/x86/dl-cacheinfo.h @@ -770,11 +770,10 @@ get_common_cache_info (long int *shared_ptr, long int * shared_per_thread_ptr, u level. */ threads = ((cpu_features->features[CPUID_INDEX_1].cpuid.ebx >> 16) & 0xff); - + } /* Get per-thread size of highest level cache. */ if (shared_per_thread > 0 && threads > 0) shared_per_thread /= threads; - } } /* Account for non-inclusive L2 and L3 caches. */