From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDA12C433EF for ; Mon, 24 Jan 2022 08:06:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236211AbiAXIF7 (ORCPT ); Mon, 24 Jan 2022 03:05:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233770AbiAXIF5 (ORCPT ); Mon, 24 Jan 2022 03:05:57 -0500 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3042DC06173B for ; Mon, 24 Jan 2022 00:05:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=l7vj3bqDeqqqQNc8THrJbak7O/EIdT8VwyiXzgQX1uU=; b=Z94PNBFdv24ZIwwujUERibQscT gv5D6k+HGZtQ8wQY4EcAkeNlepwLwqx8998CDbOX4AByqGHjvFhGHU6FZTvxiF9oGXhoTJuX5GNPo zSp8NtuY9ivaA33Ey2U5hIG5woeYpZeHlPauYbCI4N5tbJNO20q3HvdTFN4SagL+97cQL5nJHM8c9 LxwM49anHeeHn2vrr8OOn6chhYOpyqesCZ752qvLhUAicc7yQ7kZLWDg0drqHMhwKIhJa0YEGjMIn V+42XnsGn90kpGYacJ8XO08wTcGuubbJoFMu5hSLCyQTWm7hQEfBkrj+yc0oiSRWbs5YiMshykRNs wpCBMgQA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nBuLb-00373q-Hg; Mon, 24 Jan 2022 08:05:08 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 9E42B98624A; Mon, 24 Jan 2022 09:05:05 +0100 (CET) Date: Mon, 24 Jan 2022 09:05:05 +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 , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , "Rafael J. Wysocki" , Vitaly Kuznetsov , Tim Chen , Alison Schofield , Boris Ostrovsky Subject: Re: [PATCH 41/54] arch/x86: replace cpumask_weight with cpumask_weight_eq where appropriate Message-ID: <20220124080505.GI20638@worktop.programming.kicks-ass.net> References: <20220123183925.1052919-1-yury.norov@gmail.com> <20220123183925.1052919-42-yury.norov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220123183925.1052919-42-yury.norov@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 23, 2022 at 10:39:12AM -0800, Yury Norov wrote: > smpboot code in somw places 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. Why use a more complicated API for code that has no performance requirements? >From where I'm sitting this is a net negative for making the code harder to read.