lkml.org 
[lkml]   [2010]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] ida: fix up bitmap size calculation
Hi,

On Fri, Sep 3, 2010 at 02:20, Tejun Heo <tj@kernel.org> wrote:
> The -1 when calculating IDA_BITMAP_LONGS is intentional.  Please see
> below.
>
> struct ida_bitmap {
>        long                    nr_busy;
>        unsigned long           bitmap[IDA_BITMAP_LONGS];
> };
>
> With the -1, sizeof(struct ida_bitmap) becomes 128 bytes but if you
> remove the -1, it becomes 132 bytes.  Because ida_bitmap doesn't use
> dedicated slab (doesn't make sense as it's not a very hot data
> structure), with 132 bytes, it's gonna be allocated from 256 byte slot
> wasting ~50% of memory.  Adding a comment there to clarify why -1 is
> there would be nice tho.
>

Got it. :-) I'll prepare new patch with that comment, then.
Thank you for the explanation.

--
Regards,
Namhyung Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-09-02 19:29    [W:1.498 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site