From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x33.google.com (mail-oa1-x33.google.com [IPv6:2001:4860:4864:20::33]) by sourceware.org (Postfix) with ESMTPS id D26D13858D32 for ; Fri, 11 Aug 2023 17:29:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D26D13858D32 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-oa1-x33.google.com with SMTP id 586e51a60fabf-1a28de15c8aso1877233fac.2 for ; Fri, 11 Aug 2023 10:29:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691774961; x=1692379761; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rOuhLt0TDDXYiOPwysIef1uM+uTD5/whiFmgf7hare0=; b=T8twOOYzE4ChoPJ2wIEKshJnxrB80FwF/1KbemB6wAe3R81drHnz9BbU263jW2oHkM ClUGqqLU9nbDeTIY5JDbjis7weyoYh856E+2GQeKL/DwKW74VDCg6ynI2dJpBmw6sMCc 8Jq1U26s1e7D4+A6na8rB+ggF2Vcj4Yr62t5enFANMsEfQ2InZWrXHxMC4YgGwo5WE9M a3f4balxBxS+D+MPRAktTvlzPgVitLFBkXwzg1dfWhEjs1A1KIJSm0S3MridJj4hxkCl 0cXoWkNl4HA2IkILtA5vF+V4wWSYphc2X+riCjiAlK6jWdlDhxW7lMU50le283clhUD3 wDLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691774961; x=1692379761; 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=rOuhLt0TDDXYiOPwysIef1uM+uTD5/whiFmgf7hare0=; b=hBeamhmY+0uzowtDvWQtSHWR1Ji05D/lu/K9ALI/uapYqVtjUc33wYwW2u2eQCS8v6 /YhtnpRCLVdDIfMBasqbBP7mB6+Zm1zjGhR4pMwBsG+xPhY2pXuJAWenRhyzgOLL+rnQ haMD+LEIr+uLqQ/qLv5lRvoZT7BQOMax1rBs0Eq8or7GmMiIeox+gbnWQZUk56KYsI0x WKLXCPWjVbLER1cLI/oz42NCLM0DAhTmI4vTF97n/Y5O+u94XicyXLMTuSvgwb/113bb AdPFTIvyFpSx0C8uczzLHZF0h8k2JvOEFxswsrnt89eEThNOvD1bZNrmZb871SX/c47/ Czfg== X-Gm-Message-State: AOJu0YxK6pVKmF+xK/0i7+vWnuGDDRUg+ZLYAs3+z1FMtVfGUZLJwybo UDXfQqQSFgXEcJXByrVtEpzWbbiaHpg= X-Google-Smtp-Source: AGHT+IHz/wJf9BqxGyuiSeYzmXMZHvrC5406k0qMls1FdHhYohU7ApT8SrP/lHI+61zEOCx3xLiiqg== X-Received: by 2002:a05:6870:c594:b0:1ba:2a58:b15e with SMTP id ba20-20020a056870c59400b001ba2a58b15emr3172598oab.2.1691774961346; Fri, 11 Aug 2023 10:29:21 -0700 (PDT) Received: from noahgold-DESK.. (66.sub-174-246-202.myvzw.com. [174.246.202.66]) by smtp.gmail.com with ESMTPSA id j5-20020a056870530500b001bb947fa220sm2183024oan.32.2023.08.11.10.29.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Aug 2023 10:29:20 -0700 (PDT) From: Noah Goldstein To: libc-alpha@sourceware.org Cc: goldstein.w.n@gmail.com, hjl.tools@gmail.com, carlos@systemhalted.org Subject: [PATCH v3] x86: Fix incorrect scope of setting `shared_per_thread` [BZ# 30745] Date: Fri, 11 Aug 2023 12:29:11 -0500 Message-Id: <20230811172911.3705552-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 Content-Transfer-Encoding: 8bit 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 List-Id: 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 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h index 285773039f..5ddb35c9d9 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; } + /* 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. */ -- 2.34.1