Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b7a49f0d4c34166ae84089d9f145cfaae1b0eec5
Commit:     b7a49f0d4c34166ae84089d9f145cfaae1b0eec5
Parent:     dada123d99c241d1a45798a7c77bcf99c4968704
Author:     Christoph Lameter <[EMAIL PROTECTED]>
AuthorDate: Thu Feb 14 14:21:32 2008 -0800
Committer:  Christoph Lameter <[EMAIL PROTECTED]>
CommitDate: Thu Feb 14 15:30:01 2008 -0800

    slub: Determine gfpflags once and not every time a slab is allocated
    
    Currently we determine the gfp flags to pass to the page allocator
    each time a slab is being allocated.
    
    Determine the bits to be set at the time the slab is created. Store
    in a new allocflags field and add the flags in allocate_slab().
    
    Acked-by: Mel Gorman <[EMAIL PROTECTED]>
    Reviewed-by: Pekka Enberg <[EMAIL PROTECTED]>
    Signed-off-by: Christoph Lameter <[EMAIL PROTECTED]>
---
 include/linux/slub_def.h |    1 +
 mm/slub.c                |   19 +++++++++++--------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index a849c47..98be113 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -71,6 +71,7 @@ struct kmem_cache {
 
        /* Allocation and freeing of slabs */
        int objects;            /* Number of objects in slab */
+       gfp_t allocflags;       /* gfp flags to use on each alloc */
        int refcount;           /* Refcount for slab cache destroy */
        void (*ctor)(struct kmem_cache *, void *);
        int inuse;              /* Offset to metadata */
diff --git a/mm/slub.c b/mm/slub.c
index 1af7f2f..ccfd411 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1078,14 +1078,7 @@ static struct page *allocate_slab(struct kmem_cache *s, 
gfp_t flags, int node)
        struct page *page;
        int pages = 1 << s->order;
 
-       if (s->order)
-               flags |= __GFP_COMP;
-
-       if (s->flags & SLAB_CACHE_DMA)
-               flags |= SLUB_DMA;
-
-       if (s->flags & SLAB_RECLAIM_ACCOUNT)
-               flags |= __GFP_RECLAIMABLE;
+       flags |= s->allocflags;
 
        if (node == -1)
                page = alloc_pages(flags, s->order);
@@ -2333,6 +2326,16 @@ static int calculate_sizes(struct kmem_cache *s)
        if (s->order < 0)
                return 0;
 
+       s->allocflags = 0;
+       if (s->order)
+               s->allocflags |= __GFP_COMP;
+
+       if (s->flags & SLAB_CACHE_DMA)
+               s->allocflags |= SLUB_DMA;
+
+       if (s->flags & SLAB_RECLAIM_ACCOUNT)
+               s->allocflags |= __GFP_RECLAIMABLE;
+
        /*
         * Determine the number of objects per slab
         */
-
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