Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1925744rdb; Thu, 7 Dec 2023 12:39:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IFGCRdc2lhCK+/uaE5HFkkLfb+UJf+j/X3c08bf8IDM07tRRLWeFWkhgFLCNPPfeknQgNOO X-Received: by 2002:a92:d8d2:0:b0:35d:6997:9cb3 with SMTP id l18-20020a92d8d2000000b0035d69979cb3mr3189807ilo.52.1701981566994; Thu, 07 Dec 2023 12:39:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701981566; cv=none; d=google.com; s=arc-20160816; b=xvuOAMC7XHne/Uhy+u2w+0MhOkxzaV/OM8E9rEq1QTzIarBwglvfs5r77b76fO5fR0 te4T7Hx6u9MCMxZhYTl2nTdtnHznSaLJp9Lm6CpMZ3+A903fZMCbu1468YFRrg3lGD0i vgrts23EcnIIaOW86jbHSk+WRdw6eZj7Ld3au+dhV9aMxGZaeKrsNttIYhKVohN8BYT6 7mFnbMgaLSxdtpiWgKZG/anh1Azyx4OBeKzrThoA1/3wBYjdAinRhIzCmYNGOzXz215T WARPTziTLXqf670WKaoW8GW6XfRl7/O44rouMzP/0BrCNM6BmifOhufMS2niumIwTiIZ c+WA== 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=FOAgpJU0JgXYQxB1eWGGjpttQzJCZxojyeFpRMgz7us=; fh=1BoNDGd05aaAMfPxVJ9+hJFzTAErL73yhXGdigwpwQY=; b=W/dp2V81xrgh29Gl7IY+JJ5dCuJ9Li6Faoac+4x0j+0AxebLON6/0qostwj20J5jyj gl53Y8hhuibL62F0Re+8TymhHKZWkpv37aDO9TizTGIWLhlzvcyBZYS7t3iUtYyh3cal zF0bJuZq6GvIFLmt55qBANp8qj08S2khaXGFbk3lSXpzJ7SD19HC3Sbn9CUgXtiDMEEy rxc5zbrWijhucPqoiC/K0TLzxBaY40ku8mskZm8I/sKRFdGCvTkj6gFerr37Dw1kbJ2F zqnj0Qy04ryTHQKMeqZggSvfho1GOMWdhWOpdpu7Wh7P9a2NHpw02QPRqmYpMza58fdg f/GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Xqep590r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id by32-20020a056a0205a000b005be1ee5bea2si280216pgb.374.2023.12.07.12.39.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 12:39:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Xqep590r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 0838D8149709; Thu, 7 Dec 2023 12:39:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235249AbjLGUjJ (ORCPT + 99 others); Thu, 7 Dec 2023 15:39:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443910AbjLGUi7 (ORCPT ); Thu, 7 Dec 2023 15:38:59 -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 58D211713 for ; Thu, 7 Dec 2023 12:39:06 -0800 (PST) Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-5d4f71f7e9fso12608867b3.0 for ; Thu, 07 Dec 2023 12:39:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701981545; x=1702586345; 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=FOAgpJU0JgXYQxB1eWGGjpttQzJCZxojyeFpRMgz7us=; b=Xqep590r941VZkOUVFs8NAvGcJyrybGQ+D4OK0fCdAIsOFEllsPu9MZxp6fCQyp8W8 255bYY/qu202GuFgq/qxuasMGiC3pt90EczWSvSCqXW7yEpHLbaBe1MUhYAccGXzvCnm 5iTP3+8rZsKmj5ZGsIzK++BGFc5cbb0d9hMfUlB4XW4egAaRqPgWehlX0yA+77mo1NCB W0w4II17E9M93yAnsBvi/biJHskcBg9wXNWla8tf+Qn7sGHwhz1pivRBg88bu17y0PJE Qr9COoYz0s5x5jFkEIJ86yQQRwhO4h9kBxvAA7uzhX5ONDlBmuFARoXrTNJkXLL54WbV mh/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701981545; x=1702586345; 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=FOAgpJU0JgXYQxB1eWGGjpttQzJCZxojyeFpRMgz7us=; b=Vd92i7AK2DbH2uzMKx+lwRyb7wSQCZyb+mlEXrgHkOiaBbrGELwDeXbC3K4uC5SrkB 6v8XU4axNELi1c+84hZR5TbkydInQNoM0vgB2YWqZ47WMTzokjFcjJdbXZxnbpO/4gUm QPqhks5orE8MHDElS9p5uMBl8gkGOtG0vAa/obTuYWjPLCJN69EuYPaiaqo+YpyxtwjQ +ifSyxgCueMrrt+b6M8XAuIks+vOZplShyNsWcbLL1yV63wKYwkOVW+29oHtVpdv+V7w 8Ihi+5ZTl9vJZAwnk72UTVi/LtL3DiREzmFXb4BXdwKvKMcC8AdSePG+dbYFm03AugbS 35kg== X-Gm-Message-State: AOJu0Yw042IcdAt32cPWgJYyvdIwuUekbLW6wkf9GpgZAmuX1YVhhjqt GhzJOkAAtROwU97VMDe0PJ0= X-Received: by 2002:a05:690c:c0a:b0:5d7:3f4d:2e2f with SMTP id cl10-20020a05690c0c0a00b005d73f4d2e2fmr2972497ywb.14.1701981545421; Thu, 07 Dec 2023 12:39:05 -0800 (PST) Received: from localhost ([2601:344:8301:57f0:8f7f:efcd:5388:af4f]) by smtp.gmail.com with ESMTPSA id g68-20020a0dc447000000b005cb7fccffe2sm139604ywd.126.2023.12.07.12.39.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 12:39:04 -0800 (PST) From: Yury Norov To: Andrew Morton , Thomas Gleixner , linux-kernel@vger.kernel.org Cc: Yury Norov , Ming Lei , Andy Shevchenko , Rasmus Villemoes Subject: [PATCH v2 2/6] lib/group_cpus: relax atomicity requirement in grp_spread_init_one() Date: Thu, 7 Dec 2023 12:38:56 -0800 Message-Id: <20231207203900.859776-3-yury.norov@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231207203900.859776-1-yury.norov@gmail.com> References: <20231207203900.859776-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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Thu, 07 Dec 2023 12:39:23 -0800 (PST) Because nmsk and irqmsk are stable, extra atomicity is not required. Signed-off-by: Yury Norov --- lib/group_cpus.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/group_cpus.c b/lib/group_cpus.c index ee272c4cefcc..8eb18c6bbf3b 100644 --- a/lib/group_cpus.c +++ b/lib/group_cpus.c @@ -24,8 +24,8 @@ static void grp_spread_init_one(struct cpumask *irqmsk, struct cpumask *nmsk, if (cpu >= nr_cpu_ids) return; - cpumask_clear_cpu(cpu, nmsk); - cpumask_set_cpu(cpu, irqmsk); + __cpumask_clear_cpu(cpu, nmsk); + __cpumask_set_cpu(cpu, irqmsk); cpus_per_grp--; /* If the cpu has siblings, use them first */ @@ -34,9 +34,8 @@ static void grp_spread_init_one(struct cpumask *irqmsk, struct cpumask *nmsk, sibl = cpumask_next(sibl, siblmsk); if (sibl >= nr_cpu_ids) break; - if (!cpumask_test_and_clear_cpu(sibl, nmsk)) - continue; - cpumask_set_cpu(sibl, irqmsk); + __cpumask_clear_cpu(sibl, nmsk); + __cpumask_set_cpu(sibl, irqmsk); cpus_per_grp--; } } -- 2.40.1