From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C373320CBB for ; Mon, 22 Dec 2025 19:11:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766430705; cv=none; b=KGUeQiP62Ui6/NseKA9Ny8oXqqVQV0z1ott4uRsISR8LmmKOoT2ajXYrfGt+1HgJl9CEUZwC9EjE3Lfb7C9RF0WiPr1XOnBjT+2NrckLVRiqUgpLvTwGXN0mjH0Afk75H6oKcbgd1qdRF0xgGJEwSP0vN4OetJDnYLNStcna9MU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766430705; c=relaxed/simple; bh=L3gp5BJrwvgwTdc0QS+wlVj7nLjoquTymkYwUYVyzrE=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=QgVpbzofApTeiuZ3JCaF/njg0m+82iqT/hw4K4A7EGv9GZ/59FMfT9cWVus1ZjkkTlCJy6wzDtNqTN1/2NJrTMafAtdt7XDakulygovEXCHWy4FYhli9jkICIp+s+fJVb+FnLXI3SVd2NjNmVZoFp5C5LqYNZA4nlpfPFXwungQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ApHCxGzb; arc=none smtp.client-ip=209.85.128.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ApHCxGzb" Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-78fc174ada4so19030067b3.2 for ; Mon, 22 Dec 2025 11:11:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766430702; x=1767035502; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=okinICl3yjsdWDXn0sHg10Q5ko42W/lnYIUn57pLXCo=; b=ApHCxGzbO8kNG62ivdiWpX95x7AQJgYluQskr+clI6dLyjCchmNioIa1YLjXLc6QuS 5EQ6wxWw2XRK9c9KD51jh2Cj+2gAOKKV8I9iCWgY+vYJFrkhrCbDidVpvd/jljOUFFMK Y/l2cfqi5aiHhxMirB1xx8FUEapjqA7wucKQ51R47VgABFltW7DhZ72pEJnW+O4t6LKT OrZD5GlZDjAywTAClf7ossk1yR9OoqhTJjJpI5s02Gb8n7QyPFSGH5ClnOcPn+aV9wSl TJ+TQt0o8zA6iHPPfVPIr8DlytkwvQR2LV9Oj7xrVaqzl9RojbdXk/YXGykOvQlM9J/J Cz9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766430702; x=1767035502; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=okinICl3yjsdWDXn0sHg10Q5ko42W/lnYIUn57pLXCo=; b=ddmWLPtO+o8aiMkb5QJ4TZ9Hc3KNT2iDcff0r/TsVanWiT8JnHpv6H60iMUuDiUXNE 5ZG053u0HAhCZ35GnjriNioVW3MHvX0Avsb01+4ibt5nA+tBkAYeRdv04fXg0z/8t3Y4 rEwC463SBdCmBtAuaUyhswFp948DO55ofyXylA086KTFX0N4chgtDts2fYU3Z+woQJzz Yk8qjBOzgmqILEs1rITZYf75aEcqVoo1hzrQB5WI3TI+ls2i5vTwz+yGsLFIMO5q8v0M ZfsP4qQ6Rw1YhBaNTJglNgYiK5PCM9VK8jsMkPMxfiWMsCKwQSw7nMr+tpIIeeGmyDO9 AtJA== X-Forwarded-Encrypted: i=1; AJvYcCWN+amsQ0nKQtURmezpj5gygMPp5BCBphHTwcFwkOY6IKn0DEBTNOumnlDNnRC0naUTqFq2ZI+lIa5lnt4=@vger.kernel.org X-Gm-Message-State: AOJu0YxGUjFEqEjH4edVnd//i1DOhVwWMqiAQBHRTqt6xfPFxabaZ+hN +Bk7KhcwKq0nvflgisIsNcVJG7xO7xIPmu6+my6XcEoCyZBzP0OwJJJO X-Gm-Gg: AY/fxX4H1NDqZXrs4bKzmUIwbill/AZI79Mh9nKUQ/2+sbJLoru7dw1EiohUFKnhula 2+3ZhHIliGpRATm5ymbdsFgO5Tu2jzkVXkD84SmhTWUr4kN9mV30zpsw2w4/uhquqIMjiCLC4qa k/2gwAPgdKgGfv/U4q9rFpDT0HtH4Rovo23Mp0LQZHnLauSTxJSva22tkUUaOwCP8a5iiuRsc96 f9uoVocJKPMBf26tkNwwCTWh+9u38r8SkRPZZLsCAi7v9OGxwxRbsrSVqDrBvuXoEOOws8DPtyP fSUzj4HV1uR8ozl845kTpQbby9YAZsxwybjSKGolDlCJoK2fPwVWCMBDtLtPV0Vn8keo7nwyCV9 Lkb6HaMguGE0/ONRRrb1VMicedWjY+s0JznYsd1AGJccNQCAjE+YNCLJjyML8Y4HYU/uT3aZ5We CeTMfAKLk= X-Google-Smtp-Source: AGHT+IFX/d5YgwxMSa1qg+xu+SxvRFFtHrBrn5PF3NIhAhHZF1uWv/IEww2810jixrGjBk46jcrGiw== X-Received: by 2002:a05:690c:6ac8:b0:786:5c90:922b with SMTP id 00721157ae682-78fb4002b46mr97756867b3.35.1766430702459; Mon, 22 Dec 2025 11:11:42 -0800 (PST) Received: from localhost ([2601:346:0:79bd:98ae:7902:ebbf:ba29]) by smtp.gmail.com with ESMTPSA id 00721157ae682-78fb43782bfsm46088157b3.5.2025.12.22.11.11.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Dec 2025 11:11:42 -0800 (PST) From: "Yury Norov (NVIDIA)" To: Ingo Molnar , Thomas Gleixner , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Yury Norov , Rasmus Villemoes , Andrew Morton , "Peter Zijlstra (Intel)" , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Tony Luck , "Xin Li (Intel)" , "Chang S. Bae" , x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/2] x86/topology: add bitmap_weight_from() and use it in topo_unit_count() Date: Mon, 22 Dec 2025 14:11:36 -0500 Message-ID: <20251222191140.380498-1-yury.norov@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Currently the function open-codes the missing bitmap_weight_from() with a for-loop, which is known to be less effective. Add the helper and switch topo_unit_count() to using it. v1: https://lore.kernel.org/all/20251214235437.244125-1-yury.norov@gmail.com/ v2: - rename 'nbits' to 'end' (Ingo); - leverage bitmap_weight() in inline implementation; - drop outline implementation; - don't handle 'start >= end' case explititly, leave it to user. Yury Norov (NVIDIA) (2): bitmap: add bitmap_weight_from() x86/topology: use bitmap_weight_from() arch/x86/kernel/cpu/topology.c | 8 ++------ include/linux/bitmap.h | 30 ++++++++++++++++++++++++++++++ lib/test_bitmap.c | 26 ++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 6 deletions(-) -- 2.43.0