[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20090721153356.f62d8424.akpm@linux-foundation.org>
Date: Tue, 21 Jul 2009 15:33:56 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Dave Hansen <dave@...ux.vnet.ibm.com>
Cc: containers@...ts.linux-foundation.org, bblum@...gle.com,
linux-kernel@...r.kernel.org, menage@...gle.com
Subject: Re: [RFC][PATCH] flexible array implementation
On Tue, 21 Jul 2009 14:56:51 -0700
Dave Hansen <dave@...ux.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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists