Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp519936pxb; Fri, 28 Jan 2022 04:28:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzBTmlFH0qJKdzTvUAT+nnx68A5tpivQXWzTD8t/f7YLGZgOKwBmY26+wxV/etHIWHcyo1 X-Received: by 2002:a17:902:bd0a:: with SMTP id p10mr8522860pls.159.1643372918797; Fri, 28 Jan 2022 04:28:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643372918; cv=none; d=google.com; s=arc-20160816; b=hZONqfpHr86AKNNt3xwmIBMcezxKprdQZDlSRlFsqVeUolvypkSJJjSoJWvAEnSUXX WzJ6NsMyJJpUEP86Slm6YuZqmVPOJSCqJ2nEcP88v4lahQZCtIu1dlokxaETEDlUSmiz yfyStslFYWx/FyTcMjPLaIoSxlQhLGy1chhJz/yw+xm3qBCTcIMuZJBAprQ5/nS4c/1I rAP1xgjvGU8Q/0T7UmnnbeYnvJD8powMw5mRdK8MruUQdU6Ou0x306HCgF/V7cnd+Kjr ZWA7RgiPbv6uBb1+q2CfvlW2Gi9GnRXf/6/GOPt2ofMyCDEZqBOryrDKmcwdqlrEN6w1 pYPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=6IJPOuq6Vgz8OIBABNphso8njxsclBVNFuxy1S2ImKg=; b=yqSBUtMoHd93+Ik37V0ldCE2IU3wouL6ZHE9MMSCGXeq8467D50PqDpeWqVPWLY8+r hBZ0PiRjWgxYYDBhMfwFOepWqREMd54lr8O3dHd+hAwjuWJwUWX+JCdyCQKQ0TgDi3nW 7yHN91x1M5QOzF7zny3wDc2SdxnYqX/g6AWEuSDy9U1pgnCA55LBUaEa/TmiyFLFYBc9 rE4AJG+4HmvRp9Q5iJh81Tomqkvp0qoqI8yKCDqd4DcdRM+7/ibt/Y+R5oOd1MD9Qqcn t82JZMW24y4rZnjg88P0y5iLnC9lZcSun4WIU6AVNBbF+if3WLzPytjs1PzAGbFKnZeA 3tKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="hz4LA4/R"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g6si2372538pjm.44.2022.01.28.04.28.27; Fri, 28 Jan 2022 04:28:38 -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=@gmail.com header.s=20210112 header.b="hz4LA4/R"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238730AbiA0Rof (ORCPT + 99 others); Thu, 27 Jan 2022 12:44:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229956AbiA0Rod (ORCPT ); Thu, 27 Jan 2022 12:44:33 -0500 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5665C061714 for ; Thu, 27 Jan 2022 09:44:33 -0800 (PST) Received: by mail-pj1-x1033.google.com with SMTP id s61-20020a17090a69c300b001b4d0427ea2so8205265pjj.4 for ; Thu, 27 Jan 2022 09:44:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6IJPOuq6Vgz8OIBABNphso8njxsclBVNFuxy1S2ImKg=; b=hz4LA4/R1PHtVCGpkKbnhGNw4Nqv8KMtBczQ8H+o+pRWgPWJeKAvA5NHPiurEcUAwz fqOGDa9CBknJ6qeBMf1ognZpMfu2wCxmBRfm2PC4Zp7+JI6LMQTCZgwewH1cW883q+U1 iiOtwbsQeO8RUCU9GC+vr40wGP71vcjb57WaQN95ZDBqJ78+KiYqVxfh7YFJxC8Tusid veshXEQRWgjUj+ADGoyBoarqO6FAMtVLU68RDqaIWufSqgwmBvDh5rNnraWaWSB6B2X+ LyVvA/ib7ZcJkMoz2/1DEfhggw669dlJZNq2wcpGbcKAAzmO1DTMG/AMasb37aC8uJQL PUhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6IJPOuq6Vgz8OIBABNphso8njxsclBVNFuxy1S2ImKg=; b=KWWHabeJATQ1GtoOYEeukXQoDOFsLcfiWHd4F+MO+AS/3dQEVsRMJ8INjPopcgUXoU 52jcicgyGzvoMHTReZyWuPp+vJMb3NEsgT8SIgl+o4Nm0r8YOflLta+u2BWRgcDqJY3i pYEpEyNDC7aGFozft7QvBZ2vuoPBdkFa+wWJuYS/7sNIoILzkEh0mJaT2AM2qfTpUoNq 4zpciIVno48ZgZdaHKpRN07cGbvIMF1fg2Ph7Dx661iNL2sfcwZ5JwisvxmYlpGEvpFC AikdqcZF14jL7GtWvTpCvkeNarvlOxLLgIdkaZdv5mptfu72ZxHlLsHdx9/RE8FJ/86o oB6w== X-Gm-Message-State: AOAM5319mhtaiC2T9ySwFXKOQgS5VbZCk+HbjnreYUDztrZORY+Yu7Uh eJpcxSWqDP5QJ8BePHkqA5wc48LsdV7zuWwIvBkN/iRMxns= X-Received: by 2002:a17:90b:3852:: with SMTP id nl18mr15090165pjb.228.1643305473139; Thu, 27 Jan 2022 09:44:33 -0800 (PST) MIME-Version: 1.0 References: <20220123183925.1052919-1-yury.norov@gmail.com> In-Reply-To: From: Yury Norov Date: Thu, 27 Jan 2022 09:44:21 -0800 Message-ID: Subject: Re: [PATCH v3 00/54] lib/bitmap: optimize bitmap_weight() usage To: "Vaittinen, Matti" 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 , Alexey Klimov , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 25, 2022 at 11:30 PM Vaittinen, Matti wrote: > > On 1/23/22 20:38, Yury Norov wrote: > > In many cases people use bitmap_weight()-based functions to compare > > the result against a number of expression: > > > > if (cpumask_weight(mask) > 1) > > do_something(); > > > > This may take considerable amount of time on many-cpus machines because > > cpumask_weight() will traverse every word of underlying cpumask > > unconditionally. > > > > We can significantly improve on it for many real cases if stop traversing > > the mask as soon as we count cpus to any number greater than 1: > > > > if (cpumask_weight_gt(mask, 1)) > > do_something(); > > I guess I am part of the recipient list because I did the original > suggestion of adding the single_bit_set()? Yes, because of single_bit_set() > If this is the case - well, I do like this series. Overall it looks good > to me - but I for sure did not go through all the changes in detail ;) > If there is some other reason to loop me in (Eg, if someone expects me > to take a more specific look on something) - please give me a nudge. The key patch of the series is #27: "lib/bitmap: add bitmap_weight_{cmp, eq, gt, ge, lt, le} functions" Feel free to add suggested/reviewed (or whatever you find appropriate) tags if you want. Thanks, Yury