public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Dave Hansen <dave@linux.vnet.ibm.com>
Cc: containers@lists.linux-foundation.org, bblum@google.com,
	linux-kernel@vger.kernel.org, menage@google.com
Subject: Re: [RFC][PATCH] flexible array implementation
Date: Tue, 21 Jul 2009 15:33:56 -0700	[thread overview]
Message-ID: <20090721153356.f62d8424.akpm@linux-foundation.org> (raw)
In-Reply-To: <1248213411.13249.5669.camel@nimitz>

On Tue, 21 Jul 2009 14:56:51 -0700
Dave Hansen <dave@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.


  reply	other threads:[~2009-07-21 22:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-21 16:03 [RFC][PATCH] flexible array implementation Dave Hansen
2009-07-21 16:47 ` Mike Waychison
2009-07-21 17:22   ` Dave Hansen
2009-07-21 16:57 ` Denys Vlasenko
2009-07-21 17:25   ` Dave Hansen
2009-07-21 20:18 ` Andrew Morton
2009-07-21 21:56   ` Dave Hansen
2009-07-21 22:33     ` Andrew Morton [this message]
2009-07-21 20:28 ` Paul Menage

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090721153356.f62d8424.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=bblum@google.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=dave@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=menage@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox