Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 85508
b: refs/heads/master
c: eada35e
h: refs/heads/master
v: v3
  • Loading branch information
Pekka Enberg authored and Christoph Lameter committed Feb 14, 2008
1 parent 3c09f4c commit 923bc81
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e51bfd0ad10600a9fe4c8ede5ac2272e80075008
refs/heads/master: eada35efcb2773cf49aa26277e056122e1a3405c
8 changes: 6 additions & 2 deletions trunk/include/linux/slub_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,16 @@ static __always_inline struct kmem_cache *kmalloc_slab(size_t size)
void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
void *__kmalloc(size_t size, gfp_t flags);

static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
{
return (void *)__get_free_pages(flags | __GFP_COMP, get_order(size));
}

static __always_inline void *kmalloc(size_t size, gfp_t flags)
{
if (__builtin_constant_p(size)) {
if (size > PAGE_SIZE / 2)
return (void *)__get_free_pages(flags | __GFP_COMP,
get_order(size));
return kmalloc_large(size, flags);

if (!(flags & SLUB_DMA)) {
struct kmem_cache *s = kmalloc_slab(size);
Expand Down
14 changes: 6 additions & 8 deletions trunk/mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -2671,8 +2671,7 @@ void *__kmalloc(size_t size, gfp_t flags)
struct kmem_cache *s;

if (unlikely(size > PAGE_SIZE / 2))
return (void *)__get_free_pages(flags | __GFP_COMP,
get_order(size));
return kmalloc_large(size, flags);

s = get_slab(size, flags);

Expand All @@ -2689,8 +2688,7 @@ void *__kmalloc_node(size_t size, gfp_t flags, int node)
struct kmem_cache *s;

if (unlikely(size > PAGE_SIZE / 2))
return (void *)__get_free_pages(flags | __GFP_COMP,
get_order(size));
return kmalloc_large(size, flags);

s = get_slab(size, flags);

Expand Down Expand Up @@ -3219,8 +3217,8 @@ void *__kmalloc_track_caller(size_t size, gfp_t gfpflags, void *caller)
struct kmem_cache *s;

if (unlikely(size > PAGE_SIZE / 2))
return (void *)__get_free_pages(gfpflags | __GFP_COMP,
get_order(size));
return kmalloc_large(size, gfpflags);

s = get_slab(size, gfpflags);

if (unlikely(ZERO_OR_NULL_PTR(s)))
Expand All @@ -3235,8 +3233,8 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
struct kmem_cache *s;

if (unlikely(size > PAGE_SIZE / 2))
return (void *)__get_free_pages(gfpflags | __GFP_COMP,
get_order(size));
return kmalloc_large(size, gfpflags);

s = get_slab(size, gfpflags);

if (unlikely(ZERO_OR_NULL_PTR(s)))
Expand Down

0 comments on commit 923bc81

Please sign in to comment.