[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZN3sMzYHxQyvrKMJ@smile.fi.intel.com>
Date: Thu, 17 Aug 2023 12:45:23 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Yury Norov <yury.norov@...il.com>
Cc: linux-kernel@...r.kernel.org,
Rasmus Villemoes <linux@...musvillemoes.dk>
Subject: Re: [PATCH v3 3/8] bitmap: fix opencoded bitmap_allocate_region()
On Tue, Aug 15, 2023 at 04:36:23PM -0700, Yury Norov wrote:
> bitmap_find_region() opencodes bitmap_allocate_region(). Fix it.
...
> for (pos = 0; (end = pos + BIT(order)) <= bits; pos = end) {
> - if (!__reg_op(bitmap, pos, order, REG_OP_ISFREE))
> - continue;
> - __reg_op(bitmap, pos, order, REG_OP_ALLOC);
> - return pos;
> + if (!bitmap_allocate_region(bitmap, pos, order))
> + return pos;
You can also leave more code untouched, by replacing only first conditional
with
if (bitmap_allocate_region(bitmap, pos, order))
continue;
return pos;
> }
> return -ENOMEM;
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists