lkml.org 
[lkml]   [2022]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] null_blk: Use bitmap_zalloc() when applicable
From
On 1/6/22 16:44, Dan Carpenter wrote:
> On Thu, Dec 30, 2021 at 11:28:28AM +0900, Damien Le Moal wrote:
>>>
>>> - tag_size = ALIGN(nq->queue_depth, BITS_PER_LONG) / BITS_PER_LONG;
>>> - nq->tag_map = kcalloc(tag_size, sizeof(unsigned long), GFP_KERNEL);
>>> + nq->tag_map = bitmap_zalloc(nq->queue_depth, GFP_KERNEL);
>>> if (!nq->tag_map) {
>>> kfree(nq->cmds);
>>> return -ENOMEM;
>>
>> Before this patch, tag_size would always be a multiple of BITS_PER_LONG.
>> Using bitmap_zalloc(), that alignment goes away, but I think this is OK.
>>
>
> It's still going to be a multiple of long. Bitmaps are always stored
> in longs.

Yes, I understand that. I was referring to tag_size, which was rounded
before. But tag_size is only a local variable and not the actual queue
depth, which is not rounded. I got confused :)

>
> regards,
> dan carpenter
>


--
Damien Le Moal
Western Digital Research

\
 
 \ /
  Last update: 2022-01-06 08:50    [W:0.051 / U:0.660 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site