Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cfbf07f2a80b618c42a42c20d83647ea8fcceca0
Commit:     cfbf07f2a80b618c42a42c20d83647ea8fcceca0
Parent:     6a3ee3d5529c5e66aedf91401bfac65c61998639
Author:     Christoph Lameter <[EMAIL PROTECTED]>
AuthorDate: Tue May 15 01:42:06 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue May 15 08:54:01 2007 -0700

    SLUB: CONFIG_LARGE_ALLOCS must consider MAX_ORDER limit
    
    Take MAX_ORDER into consideration when determining KMALLOC_SHIFT_HIGH.
    Otherwise we may run into a situation where we attempt to create general
    slabs larger than MAX_ORDER.
    
    Signed-off-by: Christoph Lameter <[EMAIL PROTECTED]>
    Cc: "David S. Miller" <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 include/linux/slub_def.h |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index ea27065..fd6627e 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -60,7 +60,8 @@ struct kmem_cache {
 #define KMALLOC_SHIFT_LOW 3
 
 #ifdef CONFIG_LARGE_ALLOCS
-#define KMALLOC_SHIFT_HIGH 25
+#define KMALLOC_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT) =< 25 ? \
+                               (MAX_ORDER + PAGE_SHIFT - 1) : 25)
 #else
 #if !defined(CONFIG_MMU) || NR_CPUS > 512 || MAX_NUMNODES > 256
 #define KMALLOC_SHIFT_HIGH 20
@@ -87,6 +88,9 @@ static inline int kmalloc_index(int size)
         */
        WARN_ON_ONCE(size == 0);
 
+       if (size >= (1 << KMALLOC_SHIFT_HIGH))
+               return -1;
+
        if (size > 64 && size <= 96)
                return 1;
        if (size > 128 && size <= 192)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to