Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3517118pxb; Mon, 24 Jan 2022 11:12:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJzB6yE0VWzKY/go8VG8qLmLV2izJtIohhUBIBuJCjPrm8eVDcnhuSXlX99JhYUcPScHZZah X-Received: by 2002:a63:8749:: with SMTP id i70mr12839672pge.41.1643051563351; Mon, 24 Jan 2022 11:12:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643051563; cv=none; d=google.com; s=arc-20160816; b=wjnKi4JsosYOOy9kyru/thKh4cfTEE1dQtTCHHaSt2B9o9rRdvsRK9VBI8OlU0cMAE eOquqMR4tyM73hmF1z4OqxCyibgetBJcRO/wzBtxT/sqYi9h/AleEeNlDxV7EtGVBC5N UWvL3LtPa03feHFX5TW/v/gp4fixcW4x7Vtpe+DCQ+ipAhfznfFUhPmEHd9RQ7F54Vkm pAE6rJmOkCfVgWkrxHhAAZYGjUacrtdtu0EcbteVC80RFF2TfjZUkJN4ONIZTJBPR2Wc J+0R9f+L1IrAae0VoR9ZUF6Nim4ZdEYKfmkiEWXI/9nOaWYf7HoDtPg+Ub+YOE1c5wJW rbFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=EPX3eXnb1UroWsJyy71JAsT4VP1VZ8mJceAMUM/v1aE=; b=eCYQm+rdrlahGSrzSewHEEEFtLx7UTenT40VRTTCNNtKow1myz/npHnWDau6VKMSiq pPBisDr9CjC97JyjkkK54rSxg8d8rDNu4oBiSxexwobvX7yw+HA5dgRLMQXCJqw6v7Zj /fIbkCGvMRFt6gA9MFWyvpEsHQQPHg4tBOckX8SyHZZjVPNG5lrASGYgY9q3k1aolukg Nmc9RPXs2DTg/yjkdckfFyR1+b+BOrnjaLyp0NaBACQLRQHsJQubTivA0OG8XWt8qEDk YXZiV8GStQetgs7dXZODQguSUAydqzaJufoewQrZMxJIr9SHFM+OJ6i6X1FTqbprBeVp DfXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kFhlw11i; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i14si14915687pgp.394.2022.01.24.11.12.30; Mon, 24 Jan 2022 11:12:43 -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=@intel.com header.s=Intel header.b=kFhlw11i; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241198AbiAXM3O (ORCPT + 99 others); Mon, 24 Jan 2022 07:29:14 -0500 Received: from mga07.intel.com ([134.134.136.100]:6547 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239650AbiAXM3N (ORCPT ); Mon, 24 Jan 2022 07:29:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643027353; x=1674563353; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=o7r0U7Ku8gJK9VEbYjNho62PNu3+pf6Q/1IyLG6vJkk=; b=kFhlw11iXnsD/zys52QjWkBc42TYF5UVZ/jFZSjGvVz48GItMBKX7otW PLcPatXa6l1PTFGoNsNlaZW4YewKXwc47p9t1f6OkIe1yALmou075W8za +lJKRAKCQSNwtVb5UaaMcketwTYpZP7xtJU6eB++uDeC/r5idDVyX0SbI 4C+PMtje1VSoOv9DMH8swYNU3U5WMP/Z1V0tqfYjkAa6bIrkXqUAxhTkh MEZrmE071E7YsXLklF3f5zkNDA0F3vIAriWz437Y9g5V8SaiokxfgJsi9 XOQhVk1AljwJRQwExNxPGIZ8KGn6ZhIio2KyeLVKoya3tUAzIwxULhsjj Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10236"; a="309353499" X-IronPort-AV: E=Sophos;i="5.88,311,1635231600"; d="scan'208";a="309353499" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2022 04:29:12 -0800 X-IronPort-AV: E=Sophos;i="5.88,311,1635231600"; d="scan'208";a="580353480" Received: from smile.fi.intel.com ([10.237.72.61]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2022 04:29:08 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nByS0-00DszF-DE; Mon, 24 Jan 2022 14:28:00 +0200 Date: Mon, 24 Jan 2022 14:28:00 +0200 From: Andy Shevchenko To: Yury Norov Cc: 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, Ariel Elior , Manish Chopra , "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org Subject: Re: [PATCH 10/54] net: ethernet: replace bitmap_weight with bitmap_empty for qlogic Message-ID: References: <20220123183925.1052919-1-yury.norov@gmail.com> <20220123183925.1052919-11-yury.norov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220123183925.1052919-11-yury.norov@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 23, 2022 at 10:38:41AM -0800, Yury Norov wrote: > qlogic/qed code calls bitmap_weight() to check if any bit of a given > bitmap is set. It's better to use bitmap_empty() in that case because > bitmap_empty() stops traversing the bitmap as soon as it finds first > set bit, while bitmap_weight() counts all bits unconditionally. > - if (bitmap_weight((unsigned long *)&pmap[item], 64 * 8)) > + if (!bitmap_empty((unsigned long *)&pmap[item], 64 * 8)) > - (bitmap_weight((unsigned long *)&pmap[item], > + (!bitmap_empty((unsigned long *)&pmap[item], Side note, these castings reminds me previous discussion and I'm wondering if you have this kind of potentially problematic places in your TODO as subject to fix. -- With Best Regards, Andy Shevchenko