Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3499095pxb; Mon, 24 Jan 2022 10:50:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJyFgdH7Y3Q8BmMUqa6qyrrBJLC+nIDcLmKeiBDBpjZWinHTBFc9cJDgNZl9JpCpAyNopq/6 X-Received: by 2002:a17:902:7c09:b0:148:e02f:176b with SMTP id x9-20020a1709027c0900b00148e02f176bmr15479344pll.130.1643050209848; Mon, 24 Jan 2022 10:50:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643050209; cv=none; d=google.com; s=arc-20160816; b=jJ9JQmY45qRL4SWV2MbqMVpfHo8XvjZy/mN7/lJ6Zi2H8H/ZVMsYhKwvtadsOHBT7g Rbu5JHMAMGnhvwALLlptdJRfJgYOZ514uQUIcOwthDRxhGgPKOQUPYEaBSFuUEhESyqS +wieKxiByHEZyJebVj+bjnJLPHEbV9gzrf1mbWuspNSB+zKiR0it9cr6q55WcXcGvmUE bfq2E+fTu/4CcLWua6eLfUEvG7b5PbHshaVVkxdEzEP1JR3wpHKdtY437NyD5oN4lFFz C15v80vj/8CwB0riC4TrpAYxsmzhDU9gyEHO4BlOi0E32D94MUmzKSeP0Y+4V9zIuKc/ r2CQ== 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=wV3SNZJt019Z8eknUHkpxEDgSZUD0nuuRc3+d39hdr0=; b=fkdvIGW+a/qO6QkNRZNj4ms2326YtGuFRLmSArW4Dcmbt2VUQKUBDb2o1ge3CV+Ow2 ecK/tnAqEdXXtF9tEb4AnU62KhI0mvstbt2zZ6seDM1aNEfgy5LpXBLih95Ur7fKYfTe AGVdcJl8mTkZZ8x26gUTGOAh8rlxVkOJm75Fj9SCAYPXbxfar9UOju23yd/bvz49OJJp 1P4ZAmrRMsiLySKhbzH6BLi7cmbVx6uO4R66hrusBfGBUu3XgeC5FuJg7OS3EVAQag9O LUwZo0/zImAoTCy1OilH3fwIHmvTrgH1SVL3bwcUWfCVpCV/OT55XA2v+a1oa9yxETfC C9cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Q6PD5OPj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x184si8577241pgd.280.2022.01.24.10.49.57; Mon, 24 Jan 2022 10:50:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Q6PD5OPj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242056AbiAXIHJ (ORCPT + 99 others); Mon, 24 Jan 2022 03:07:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242037AbiAXIHE (ORCPT ); Mon, 24 Jan 2022 03:07:04 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89A56C061744 for ; Mon, 24 Jan 2022 00:07:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=wV3SNZJt019Z8eknUHkpxEDgSZUD0nuuRc3+d39hdr0=; b=Q6PD5OPjKjQCu4KgAV3mY8DoM2 8JmtpdNX5ydY2gti/ah6ib99vAF8oQgWSbUO/ZWln2rM54eQMIcxRxdDeFJtAXL+3xfu8sA5E2yA4 /7iWBZ799RSa2r1gDs3w1Z0PdjqTtgAVCWUiGRGk+t7cX412VWnhPP5tl5hXjjsFCs1H/ZRLcwGJh mAfhkEIkALZ14KK7XnVFmu4ROB2jluLNiTBYPrvoFCUtOw75FyHHReBnrmDQtN3NSXjDSmi/zMR2q JyoytrPtPghvw1lAIYVueNsDyfuxseF6MtODoC2R0gjQgRJt4m0HP3H4j4d2QhfiDR0o45LbqtdzZ nou8xg9Q==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBuN6-000JI7-E5; Mon, 24 Jan 2022 08:06:41 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 4177598624A; Mon, 24 Jan 2022 09:06:39 +0100 (CET) Date: Mon, 24 Jan 2022 09:06:39 +0100 From: Peter Zijlstra To: Yury Norov Cc: Andy Shevchenko , Rasmus Villemoes , Andrew Morton , =?utf-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , Greg Kroah-Hartman , David Laight , Joe Perches , Dennis Zhou , Emil Renner Berthing , Nicholas Piggin , Matti Vaittinen , Alexey Klimov , linux-kernel@vger.kernel.org, Thomas Gleixner Subject: Re: [PATCH 48/54] kernel/time: replace cpumask_weight with cpumask_weight_eq where appropriate Message-ID: <20220124080639.GK20638@worktop.programming.kicks-ass.net> References: <20220123183925.1052919-1-yury.norov@gmail.com> <20220123183925.1052919-49-yury.norov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220123183925.1052919-49-yury.norov@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 23, 2022 at 10:39:19AM -0800, Yury Norov wrote: > tick_cleanup_dead_cpu() 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 met. But again, nobody gives a crap about performance here.. > Signed-off-by: Yury Norov > --- > kernel/time/clockevents.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c > index 003ccf338d20..32d6629a55b2 100644 > --- a/kernel/time/clockevents.c > +++ b/kernel/time/clockevents.c > @@ -648,7 +648,7 @@ void tick_cleanup_dead_cpu(int cpu) > */ > list_for_each_entry_safe(dev, tmp, &clockevent_devices, list) { > if (cpumask_test_cpu(cpu, dev->cpumask) && > - cpumask_weight(dev->cpumask) == 1 && > + cpumask_weight_eq(dev->cpumask, 1) && > !tick_is_broadcast_device(dev)) { > BUG_ON(!clockevent_state_detached(dev)); > list_del(&dev->list); > -- > 2.30.2 >