From patchwork Fri Aug 11 00:31:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noah Goldstein X-Patchwork-Id: 1820079 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=xg3CXEw4; 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 4RMPqp0Dddz1yYC for ; Fri, 11 Aug 2023 10:31:49 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7B5013858298 for ; Fri, 11 Aug 2023 00:31:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7B5013858298 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1691713906; bh=SZILiyBQQYUo8GoAd5IBY6HyEJaeOgksY9jBvrLKnpw=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=xg3CXEw4Whku7QKYm1bjd0/+9LAYWsEV8+5x5V/OVSi/RA/5JCISowSVDIgfxogML 1GJUzzkfz95fm268T9hOnUJGgyn4CCp12Akvpbd4Xztsm5Fx38iMd8kFn4tGWGYa2D PILMEfTPTPzBaxdqJCwGK0Dqts1/Z2030aFvZUWY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id CA24E3858D20 for ; Fri, 11 Aug 2023 00:31:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CA24E3858D20 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-99bdeae1d0aso202311366b.1 for ; Thu, 10 Aug 2023 17:31:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691713888; x=1692318688; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SZILiyBQQYUo8GoAd5IBY6HyEJaeOgksY9jBvrLKnpw=; b=FT8S56OuHU78j/thoe55+TDh6wFhXV25MsdR8/Zol5CswQLzM2Qvv0HBsJ/GiGHhov su2G2xy61VNAebIun8xy2wjWziXK2hfvopwIx3goUzLnVYWlWDxUBtefQhR7uad7cafz Nv7GG36BVPgjQ7XAQXH26VNGS6Cu292/l3gcv7OJjn3lPIGyKPdREOnx1W5TWXpvM5vQ vyA+M0EdBqZLFmQQ+slPkPEan8QiBIcmuqO71xqACqtAOhAXZ6loQUCYuq56yvr7C4pU H09TVhYDI8pZpagTwmQHixf9peKcHn6esrTtttghPWd06FemU8wOkIu2G1OZCckLdUuR 0pyw== X-Gm-Message-State: AOJu0YzbzjrH6jjdImZF7I9cBkx+5UCVRW21UnAIr+rYA55zRprfl+fz wmOuPudZwwEZ2M3y1VHLC6KqJemTQtU= X-Google-Smtp-Source: AGHT+IHFWji/uQhjJW8lZYjQtU8qQemaiGbql5rbkXbwn+8FkSeeQ/H8Z1+ajZXakNgB7B69qXD6Wg== X-Received: by 2002:a17:906:32d5:b0:99c:44fd:87d7 with SMTP id k21-20020a17090632d500b0099c44fd87d7mr332160ejk.58.1691713887629; Thu, 10 Aug 2023 17:31:27 -0700 (PDT) Received: from noahgold-DESK.intel.com ([192.55.55.58]) by smtp.gmail.com with ESMTPSA id cb13-20020a170906a44d00b0099bc08862b6sm1583597ejb.171.2023.08.10.17.31.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 17:31:26 -0700 (PDT) To: libc-alpha@sourceware.org Cc: goldstein.w.n@gmail.com, hjl.tools@gmail.com, carlos@systemhalted.org Subject: [PATCH v1] x86: Fix incorrect scope of setting `shared_per_thread` Date: Thu, 10 Aug 2023 19:31:09 -0500 Message-Id: <20230811003109.3046769-1-goldstein.w.n@gmail.com> X-Mailer: git-send-email 2.34.1 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. */