[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ye6fsynB1/q0ZLui@smile.fi.intel.com>
Date: Mon, 24 Jan 2022 14:46:43 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Yury Norov <yury.norov@...il.com>
Cc: Rasmus Villemoes <linux@...musvillemoes.dk>,
Andrew Morton <akpm@...ux-foundation.org>,
Michał Mirosław <mirq-linux@...e.qmqm.pl>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Peter Zijlstra <peterz@...radead.org>,
David Laight <David.Laight@...lab.com>,
Joe Perches <joe@...ches.com>, Dennis Zhou <dennis@...nel.org>,
Emil Renner Berthing <kernel@...il.dk>,
Nicholas Piggin <npiggin@...il.com>,
Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
Alexey Klimov <aklimov@...hat.com>,
linux-kernel@...r.kernel.org, Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Nathan Chancellor <nathan@...nel.org>,
Alexandru Ardelean <alexandru.ardelean@...log.com>,
linux-iio@...r.kernel.org
Subject: Re: [PATCH 29/54] drivers/iio: replace bitmap_weight() with
bitmap_weight_{eq,gt} where appropriate
On Sun, Jan 23, 2022 at 10:39:00AM -0800, Yury Norov wrote:
> drivers/iio calls bitmap_weight() to compare the weight of bitmap with
> a given number. We can do it more efficiently with bitmap_weight_{eq, gt}
> because conditional bitmap_weight may stop traversing the bitmap earlier,
> as soon as condition is met.
...
> int i, j;
>
> for (i = 0, j = 0;
> - i < bitmap_weight(indio_dev->active_scan_mask,
> - indio_dev->masklength);
> + bitmap_weight_gt(indio_dev->active_scan_mask,
> + indio_dev->masklength, i);
> i++, j++) {
> j = find_next_bit(indio_dev->active_scan_mask,
> indio_dev->masklength, j);
This smells like room for improvement. Have you checked this deeply?
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists