Skip to content

Commit

Permalink
slub: Use a constant for a unspecified node.
Browse files Browse the repository at this point in the history
kmalloc_node() and friends can be passed a constant -1 to indicate
that no choice was made for the node from which the object needs to
come.

Use NUMA_NO_NODE instead of -1.

CC: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Christoph Lameter <cl@linux-foundation.org>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
  • Loading branch information
Christoph Lameter authored and Pekka Enberg committed Jul 16, 2010
1 parent 1c5474a commit 2154a33
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ static inline struct page *alloc_slab_page(gfp_t flags, int node,

flags |= __GFP_NOTRACK;

if (node == -1)
if (node == NUMA_NO_NODE)
return alloc_pages(flags, order);
else
return alloc_pages_exact_node(node, flags, order);
Expand Down Expand Up @@ -1387,7 +1387,7 @@ static struct page *get_any_partial(struct kmem_cache *s, gfp_t flags)
static struct page *get_partial(struct kmem_cache *s, gfp_t flags, int node)
{
struct page *page;
int searchnode = (node == -1) ? numa_node_id() : node;
int searchnode = (node == NUMA_NO_NODE) ? numa_node_id() : node;

page = get_partial_node(get_node(s, searchnode));
if (page || (flags & __GFP_THISNODE))
Expand Down Expand Up @@ -1515,7 +1515,7 @@ static void flush_all(struct kmem_cache *s)
static inline int node_match(struct kmem_cache_cpu *c, int node)
{
#ifdef CONFIG_NUMA
if (node != -1 && c->node != node)
if (node != NUMA_NO_NODE && c->node != node)
return 0;
#endif
return 1;
Expand Down Expand Up @@ -1727,7 +1727,7 @@ static __always_inline void *slab_alloc(struct kmem_cache *s,

void *kmem_cache_alloc(struct kmem_cache *s, gfp_t gfpflags)
{
void *ret = slab_alloc(s, gfpflags, -1, _RET_IP_);
void *ret = slab_alloc(s, gfpflags, NUMA_NO_NODE, _RET_IP_);

trace_kmem_cache_alloc(_RET_IP_, ret, s->objsize, s->size, gfpflags);

Expand All @@ -1738,7 +1738,7 @@ EXPORT_SYMBOL(kmem_cache_alloc);
#ifdef CONFIG_TRACING
void *kmem_cache_alloc_notrace(struct kmem_cache *s, gfp_t gfpflags)
{
return slab_alloc(s, gfpflags, -1, _RET_IP_);
return slab_alloc(s, gfpflags, NUMA_NO_NODE, _RET_IP_);
}
EXPORT_SYMBOL(kmem_cache_alloc_notrace);
#endif
Expand Down Expand Up @@ -2728,7 +2728,7 @@ void *__kmalloc(size_t size, gfp_t flags)
if (unlikely(ZERO_OR_NULL_PTR(s)))
return s;

ret = slab_alloc(s, flags, -1, _RET_IP_);
ret = slab_alloc(s, flags, NUMA_NO_NODE, _RET_IP_);

trace_kmalloc(_RET_IP_, ret, size, s->size, flags);

Expand Down Expand Up @@ -3312,7 +3312,7 @@ void *__kmalloc_track_caller(size_t size, gfp_t gfpflags, unsigned long caller)
if (unlikely(ZERO_OR_NULL_PTR(s)))
return s;

ret = slab_alloc(s, gfpflags, -1, caller);
ret = slab_alloc(s, gfpflags, NUMA_NO_NODE, caller);

/* Honor the call site pointer we recieved. */
trace_kmalloc(caller, ret, size, s->size, gfpflags);
Expand Down

0 comments on commit 2154a33

Please sign in to comment.