linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Christoph Lameter <clameter@sgi.com>
Cc: linux-mm@kvack.org
Subject: Re: slab allocators: MAX_ORDER one off fix
Date: Sat, 23 Jun 2007 09:53:34 -0700	[thread overview]
Message-ID: <20070623095334.51f80e94.akpm@linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0706221100270.17293@schroedinger.engr.sgi.com>

> On Fri, 22 Jun 2007 11:02:17 -0700 (PDT) Christoph Lameter <clameter@sgi.com> wrote:
> MAX_ORDER is the first order that is not possible.
> 
> Use MAX_ORDER - 1 to calculate the larges possible object size in slab.h
> 
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
> 
> ---
>  include/linux/slab.h |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6.22-rc4-mm2/include/linux/slab.h
> ===================================================================
> --- linux-2.6.22-rc4-mm2.orig/include/linux/slab.h	2007-06-22 10:46:12.000000000 -0700
> +++ linux-2.6.22-rc4-mm2/include/linux/slab.h	2007-06-22 10:46:53.000000000 -0700
> @@ -133,8 +133,8 @@ static inline void *kmem_cache_alloc_nod
>   * to do various tricks to work around compiler limitations in order to
>   * ensure proper constant folding.
>   */
> -#define KMALLOC_SHIFT_HIGH	((MAX_ORDER + PAGE_SHIFT) <= 25 ? \
> -				(MAX_ORDER + PAGE_SHIFT) : 25)
> +#define KMALLOC_SHIFT_HIGH	((MAX_ORDER + PAGE_SHIFT - 1) <= 25 ? \
> +				(MAX_ORDER + PAGE_SHIFT - 1) : 25)
>  
>  #define KMALLOC_MAX_SIZE	(1UL << KMALLOC_SHIFT_HIGH)
>  #define KMALLOC_MAX_ORDER	(KMALLOC_SHIFT_HIGH - PAGE_SHIFT)

I'm too lazy to look.  What are the consequences of deferring this to
2.6.23?  Oversized kmallocs will still get a runtime failure, so no real
problem?


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2007-06-23 16:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-22 18:02 Christoph Lameter
2007-06-23 16:53 ` Andrew Morton [this message]
2007-06-25 13:06   ` Christoph Lameter

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=20070623095334.51f80e94.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=clameter@sgi.com \
    --cc=linux-mm@kvack.org \
    /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