Re: Re: [PATCH] bitmap: Add bitmap_valloc(), bitmap_vzalloc() and bitmap_vfree()

From: çé
Date: Fri Dec 28 2018 - 23:16:07 EST


On Date: Fri, 28 Dec 2018 15:41:37 -0800 Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:

> From: "Andrew Morton" <akpm@xxxxxxxxxxxxxxxxxxxx>
> Sent Time: 2018-12-29 07:41:37 (Saturday)
> To: "Peng Wang" <rocking@xxxxxxxxxx>
> Cc: andriy.shevchenko@xxxxxxxxxxxxxxx, linux@xxxxxxxxxxxxxxxxxx, ynorov@xxxxxxxxxxxxxxxxxx, arnd@xxxxxxxx, courbet@xxxxxxxxxx, osandov@xxxxxx, linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH] bitmap: Add bitmap_valloc(), bitmap_vzalloc() and bitmap_vfree()
>
> On Fri, 28 Dec 2018 00:18:29 +0800 Peng Wang <rocking@xxxxxxxxxx> wrote:
>
> > Introduce bitmap alloc/free helpers when contiguous
> > memory is not necessary.
>
> That's a large bitmap you have there. What code needs this?

Hi Andrew,
Not only for large bitmap. This can also benefit from high memory pressure with no requirement for physical continuousness.

While these two casees are rather rare. And I only find one place in mm/swapfile.c.

3224 /* frontswap enabled? set up bit-per-page map for frontswap */
3225 if (IS_ENABLED(CONFIG_FRONTSWAP))
3226 frontswap_map = kvcalloc(BITS_TO_LONGS(maxpages),
3227 sizeof(long),
3228 GFP_KERNEL);

I am not sure whether these helper functions can gain as much benefits as the efforts to introduce them.

Cheers,
Peng