[Devel] Re: [RFC][PATCH] flexible array implementation
Andrew Morton
akpm at linux-foundation.org
Tue Jul 21 15:33:56 PDT 2009
On Tue, 21 Jul 2009 14:56:51 -0700
Dave Hansen <dave at linux.vnet.ibm.com> wrote:
> I've added some comments in the kerneldoc for the (newly renamed) alloc
> function:
>
> * The maximum number of elements is currently the number of elements
> * that can be stored in a page times the number of page pointers
> * that we can fit in the base structure or (using integer math):
> *
> * (PAGE_SIZE/element_size) * (PAGE_SIZE-8)/sizeof(void *)
> *
> * Here's a table showing example capacities. Note that the maximum
> * index that the get/put() functions is just nr_objects-1.
> *
> * Element size | Objects | Objects |
> * PAGE_SIZE=4k | 32-bit | 64-bit |
> * ----------------------------------|
> * 1 byte | 4186112 | 2093056 |
> * 2 bytes | 2093056 | 1046528 |
> * 3 bytes | 1395030 | 697515 |
> * 4 bytes | 1046528 | 523264 |
> * 32 bytes | 130816 | 65408 |
> * 33 bytes | 126728 | 63364 |
> * 2048 bytes | 2044 | 10228 |
> * 2049 bytes | 1022 | 511 |
> * void * | 1046528 | 261632 |
4-bytes on 32-bit and 8-bytes on 64-bit are the most interesting ones
(IMO). So what we're basically saying is "2MB on 64-bit".
I wonder if that's enough for known likely callers. Hopefully it is.
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list