Messages in this thread | | | From | Namhyung Kim <> | Date | Fri, 3 Sep 2010 02:25:22 +0900 | Subject | Re: [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/
| |