Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4411082rdb; Mon, 11 Dec 2023 20:22:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IG3yxpJDhS2wZ+fDu9f17BhLD6ItClAz90mTdZ5Ky1wpZvLMuARdD9AOsEkDjFefLoQ6sPu X-Received: by 2002:a17:90a:bf05:b0:286:5742:dfce with SMTP id c5-20020a17090abf0500b002865742dfcemr5824611pjs.4.1702354925107; Mon, 11 Dec 2023 20:22:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702354925; cv=none; d=google.com; s=arc-20160816; b=n0t/4DNE2zCpIgy84IhFwbLNcMv8yq3HUog2yLOCt4t8sZnOCJ3MxzL0YVOsceqxH5 mfjdftUgEaptBkWGuSJ7Re3eRSiTUNXyI05OEJabavpKUIEgOzUeyiJVF9vLyw/hVzZb jooykSLJ5C6lohaTTkzcCjZCbq5B0GFXrawSz5YSzN60LC4077kyL0PAdnCtbYPeTLGx D34nX+NucgZONIGGxx0Frqp7QXKBEWpJaBYtS/joT1SFHoznENeTeKk7oON3K/mHmmq3 C+Xml/cwxgKExex9eoSnhgL/GfUoNFh+lS4viC2f7yFbR4W7DivqCKFx3jd2MkF74d1H oZgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Mhqx4gBGm5WucjtLuvVJR4mQPOrDNcNzK+o09f7n6v4=; fh=kL/RA2Gd9NuQcovU0+7My8qgZ6xDrReyLO6zCGgffAQ=; b=d1eeiq612x6jZUQHWDzx6Am7NV5SUObmD1iqTIcjzTSCjIDvyCphbIAlcAfR4DpU1X ds5VfHksjybbqp8iRCcvH9u8fDGZ9wXGGMwiL1Lw3pw4Po0+U7S2Pb+mKAtkCNCbKcgq YZTD+2eLtjWTm+QhLMd4qLS+8GjtNencYf/PsGEkolBFaQcFadNI0miZ+QD5WmmOsy6q 12L9PzqdFLevdyff2mttqE9+02HTV1VhD8tkw+c/us9qpBnZVD469Eluozbsfi5zDgfT km5pisKV/YJ0sA3FlY47QLsr8MZ2tFlgH4LIQjA9Mbfmivt7z6w59da0NgkYhVgAbZvq 93cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=aa0ltg7q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id q5-20020a17090aa00500b002839db82641si7245952pjp.85.2023.12.11.20.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 20:22:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=aa0ltg7q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 5F0728067602; Mon, 11 Dec 2023 20:22:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345809AbjLLEVd (ORCPT + 99 others); Mon, 11 Dec 2023 23:21:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232308AbjLLEVW (ORCPT ); Mon, 11 Dec 2023 23:21:22 -0500 Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15628FD for ; Mon, 11 Dec 2023 20:21:22 -0800 (PST) Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-5e180547bdeso8183077b3.1 for ; Mon, 11 Dec 2023 20:21:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702354881; x=1702959681; darn=vger.kernel.org; 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=Mhqx4gBGm5WucjtLuvVJR4mQPOrDNcNzK+o09f7n6v4=; b=aa0ltg7q1na+bhl2xIMKgJhC7szOWXRyrN85rbIhd5JJpSgcOeDPN9ZP4bukpK1U78 4ha0vP0X+Gho+XHEcgzMz0wty/AXdtbYPo09Mjo4Hy+JzcCosKJ6RZlIP4W/iv15chkR rhibmo7DLcPCGuktvV7zOu+CkpIN0Hyh80bDe+TfytxJrAiNToy81YyJmd4cch9mQTRc 0W6+AeYkfM3cLcpobGe5nL4uuQ7Dbl1H7we/LuNR9ROCLz+GcFfdXP+eEMP/MAARUFmM rRTboHyVE3LU9Uwpej2MuNjRRDBULHZ9a8W4TDObNn8/RXlGlRG7/egXVHcKmq1gZlyn GHSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702354881; x=1702959681; 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=Mhqx4gBGm5WucjtLuvVJR4mQPOrDNcNzK+o09f7n6v4=; b=TEh+bry36o/VGIiWfaOUc8mEHYF9cUwuHgBaNDv1Z/Lv7N2bIPA43Qi9l1eaUbLlB2 77MAyq+yMaCDu6VXbJ/DZwhupZSkAiia7dcvpSDGmW55JfGcbdXWsgV0lAbEfAJHeH+/ IEiP+ib3ZmYV+ReOS2xkiEamBL6NYxwiyqqi7CS6KJG5ZPErZ4GwPRG1IUqlcGYGSEnq 70ecAuW4HZVDZuQhaLHEuV2ebJTivWxKL+vzGgyW1LJ0pNhyR0P/VDzJEGygSwHruY/l oYmYzRUdjRrLK9yOkSxJCox/D+28gBrPEQJ5Bl24u0qifQaZMfRNOzEfgmXq1QkpQo2w gopg== X-Gm-Message-State: AOJu0YwfPsdljeGNmxT3YLnG8eSYnMDSh1tnNQHk23oqMjGXHH54m/1U FD7Jz5zsXXTcg003fNRj2a8= X-Received: by 2002:a81:784c:0:b0:5e1:8bd7:c66c with SMTP id t73-20020a81784c000000b005e18bd7c66cmr1002488ywc.7.1702354881171; Mon, 11 Dec 2023 20:21:21 -0800 (PST) Received: from localhost ([2601:344:8301:57f0:38aa:1c88:df05:9b73]) by smtp.gmail.com with ESMTPSA id c189-20020a0ddac6000000b005d1b2153b7bsm3526835ywe.18.2023.12.11.20.21.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 20:21:20 -0800 (PST) From: Yury Norov To: Andrew Morton , Thomas Gleixner , Ming Lei , linux-kernel@vger.kernel.org Cc: Yury Norov , Andy Shevchenko , Rasmus Villemoes Subject: [PATCH v3 7/7] lib/group_cpus: simplify grp_spread_init_one() for more Date: Mon, 11 Dec 2023 20:21:07 -0800 Message-Id: <20231212042108.682072-8-yury.norov@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231212042108.682072-1-yury.norov@gmail.com> References: <20231212042108.682072-1-yury.norov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 11 Dec 2023 20:22:01 -0800 (PST) The outer and inner loops of grp_spread_init_one() do the same thing - move a bit from nmsk to irqmsk. The inner loop iterates the sibling group, which includes the CPU picked by outer loop. And it means that we can drop the part that moves the bit in the outer loop. Signed-off-by: Yury Norov --- lib/group_cpus.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/group_cpus.c b/lib/group_cpus.c index 664a56171a1b..7aa7a6289355 100644 --- a/lib/group_cpus.c +++ b/lib/group_cpus.c @@ -18,14 +18,8 @@ static void grp_spread_init_one(struct cpumask *irqmsk, struct cpumask *nmsk, int cpu, sibl; for_each_cpu(cpu, nmsk) { - __cpumask_clear_cpu(cpu, nmsk); - __cpumask_set_cpu(cpu, irqmsk); - if (cpus_per_grp-- == 0) - return; - - /* If the cpu has siblings, use them first */ siblmsk = topology_sibling_cpumask(cpu); - sibl = cpu + 1; + sibl = cpu; for_each_cpu_and_from(sibl, siblmsk, nmsk) { __cpumask_clear_cpu(sibl, nmsk); -- 2.40.1