Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp4542202pxb; Sat, 12 Feb 2022 08:37:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzGSi2utSKh6f4Sk93VWBnoSn2K6jpQVSIJkemmnjZO+Ha3Ndk0zBFsNPr3QRuRJja2RYCU X-Received: by 2002:a62:bd0c:: with SMTP id a12mr6883406pff.26.1644683872524; Sat, 12 Feb 2022 08:37:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644683872; cv=none; d=google.com; s=arc-20160816; b=GLtcyec/EsyTDhxQAXvRdovtp5MbD29aUrhGhVonxQYFed1cAViVe5dEcyDhtWDBgg 4buE8NYrVgBvm9DIamb8su+Ey8m59xrNizc8PWCpV38tjE8iChAYEz4VQi2zDfHtXgPY vyazMMRuu2tUsxKSRdF/wj01fyC4+0tdXZ97bKtCel2CoZzRi20gGgz1jA+7lstdckHD Z0Qj2v6dr/9mAid0QdZqZ3gWsD2y5dUZ26ddKxOMhvJe0l/CqNBM+J8d6hrhDiWtM/Q3 K0JAOGaLgBRyJUCnSqJgCP2dQC0zrWh32ejDPq3hu5KnCR8HFNj6G5HAp93oHZBIsQxa raXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EJieVrYw7bGsS/GbDwdyCqkJlHD+DNLeYNU+G9HF0Kw=; b=bYdBiG8BIEroELNoM6vjfvMQ7xezMyAucXInyRGVlYauUK/rOBlq9Muaryuk+vjYZN 6R7P8sc8+W6wnu3fHCe1wmnXI2eAdjuUxrb3JcByjc0H8JFuEuMTlcSAMxsvamHrf6As rUMRjijRAE+UjL370sL6916Uy1SLis3YB/w0D4fK46WYdjiPN/g81jE2QBV8CMRfonOe ba3vCSMIhq0lSdDxZrkQ0WzE9ST2HQ35UTbVKFnI+QU64lEP4gK776QqLJql0hDFFuwt YvtxhReohNeHh32uW2rUSituuDdFn3CDWjboLyUQvBzWkhGGt3oTOP+IXAokXuB/hP6Q P5Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=aJyCdrt6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h7si6895600pjt.129.2022.02.12.08.37.39; Sat, 12 Feb 2022 08:37:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=aJyCdrt6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354282AbiBKXm4 (ORCPT + 93 others); Fri, 11 Feb 2022 18:42:56 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354281AbiBKXmv (ORCPT ); Fri, 11 Feb 2022 18:42:51 -0500 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67105D6C; Fri, 11 Feb 2022 15:42:48 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id k18so1570222ils.11; Fri, 11 Feb 2022 15:42:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=EJieVrYw7bGsS/GbDwdyCqkJlHD+DNLeYNU+G9HF0Kw=; b=aJyCdrt6mtHVARW18KLBIZip5IXDQg3a50Kp8xN8UESpGu5Hg8vkgiS7JCTti43+MI YHzD/b+jZuTBWbpTbtgFWzZzikCdZT94HGe2M2cnWMzri3xBEX7c7vaxgRBFerE0rxuM bvcMe9NGtEpqZac2QheDaLEp3CjfrPoYKXTwSLVZ0IWpwd40PEHkzn2/ogEh5iAOw4TL S2Pq8mZCCyop5a3yYxrSOkPKb3vF/s/PW0xtrEEOEqI1qdyA3WmmIZrlfgd4c1rwuzMK kxWYhiAKGA5y8ueqQ8VWfZcTi5r/Z4k3SuxubyaLXnOcnXpxWWN0aL9Wywn91URR+8L1 4Oaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=EJieVrYw7bGsS/GbDwdyCqkJlHD+DNLeYNU+G9HF0Kw=; b=eTgeOrulndOIdVAyKHHsZBrIv0odvSeXs3hnU9O1iqLB3KvU6B0x4+W3OSxHxiksMn fgyX434kziLJ43eio06YCT4sfLlWzoJzLX/PZ9QqsVIgfbFX8D15/lfbq1peouVKvEId bSZygV2bsRud0W/SPJreuhsIUs1moMKp0fxMB0FHPEhCQr3GH3MT0OZkFi3w9W4uMSbJ 6YNGqgg8zd1tlJGjI2b+rV/dRWA+LYraUDZWi9fnPaEJWgHZ5nc9X4OxA7wXkgV/5Fht aIhtXWbTmkHQl47Lz7kjWVXIX3YL/ncRDO3JZrbpldC1T275zNsBMKsY9jA9lx3p/nnd afGw== X-Gm-Message-State: AOAM533UgaxCDJN5hr8jXn/ioDB+wuTKRTbKWrxHftQwF9zCBICeAMN3 dAyYdvoEPJcSMOcH2N2pQrw= X-Received: by 2002:a92:d648:: with SMTP id x8mr2031228ilp.142.1644622967680; Fri, 11 Feb 2022 15:42:47 -0800 (PST) Received: from localhost ([12.28.44.171]) by smtp.gmail.com with ESMTPSA id h19sm12766856ila.4.2022.02.11.15.42.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 15:42:47 -0800 (PST) Date: Fri, 11 Feb 2022 15:40:36 -0800 From: Yury Norov To: Sven Schnelle Cc: Andy Shevchenko , Rasmus Villemoes , Andrew Morton , =?utf-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , Greg Kroah-Hartman , Peter Zijlstra , David Laight , Joe Perches , Dennis Zhou , Emil Renner Berthing , Nicholas Piggin , Matti Vaittinen , Alexey Klimov , linux-kernel@vger.kernel.org, Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Alexander Gordeev , Thomas Richter , Sumanth Korikkar , Sebastian Andrzej Siewior , Jiapeng Chong , kernel test robot , linux-s390@vger.kernel.org Subject: Re: [PATCH 39/49] arch/s390: replace cpumask_weight with cpumask_weight_eq where appropriate Message-ID: References: <20220210224933.379149-1-yury.norov@gmail.com> <20220210224933.379149-40-yury.norov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 11, 2022 at 07:54:26AM +0100, Sven Schnelle wrote: > Hi Yury, > > Yury Norov writes: > > > cfset_all_start() calls cpumask_weight() to compare the weight of cpumask > > with a given number. We can do it more efficiently with > > cpumask_weight_{eq, ...} because conditional cpumask_weight may stop > > traversing the cpumask earlier, as soon as condition is (or can't be) met. > > > > Signed-off-by: Yury Norov > > --- > > arch/s390/kernel/perf_cpum_cf.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c > > index ee8707abdb6a..4d217f7f5ccf 100644 > > --- a/arch/s390/kernel/perf_cpum_cf.c > > +++ b/arch/s390/kernel/perf_cpum_cf.c > > @@ -975,7 +975,7 @@ static int cfset_all_start(struct cfset_request *req) > > return -ENOMEM; > > cpumask_and(mask, &req->mask, cpu_online_mask); > > on_each_cpu_mask(mask, cfset_ioctl_on, &p, 1); > > - if (atomic_read(&p.cpus_ack) != cpumask_weight(mask)) { > > + if (!cpumask_weight_eq(mask, atomic_read(&p.cpus_ack))) { > > on_each_cpu_mask(mask, cfset_ioctl_off, &p, 1); > > rc = -EIO; > > debug_sprintf_event(cf_dbg, 4, "%s CPUs missing", __func__); > > given that you're adding a bunch of these functions - gt,lt,eq and > others, i wonder whether it makes sense to also add cpumask_weight_ne(), > so one could just write: > > if (cpumask_weight_ne(mask, atomic_read(&p.cpus_ack))) { > ... > } > > ? It will have 3 users in cpumask + 1 in nodemask. I have no strong opinion whether we need it or not. Let's see what people say. Thanks, Yury