linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Lameter <cl@linux.com>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: linux-mm@kvack.org
Subject: [RFC SLEB 01/10] slab: Introduce a constant for a unspecified node.
Date: Fri, 14 May 2010 13:39:09 -0500	[thread overview]
Message-ID: <20100514183942.782519323@quilx.com> (raw)
In-Reply-To: 20100514183908.118952419@quilx.com

[-- Attachment #1: slab_node_unspecified --]
[-- Type: text/plain, Size: 2757 bytes --]

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.

Add a constant for this.

Signed-off-by: Christoph Lameter <cl@linux-foundation.org>

---
 include/linux/slab.h |    2 ++
 mm/slub.c            |   10 +++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

Index: linux-2.6/include/linux/slab.h
===================================================================
--- linux-2.6.orig/include/linux/slab.h	2010-04-27 12:31:57.000000000 -0500
+++ linux-2.6/include/linux/slab.h	2010-04-27 12:32:26.000000000 -0500
@@ -92,6 +92,8 @@
 #define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \
 				(unsigned long)ZERO_SIZE_PTR)
 
+#define SLAB_NODE_UNSPECIFIED (-1L)
+
 /*
  * struct kmem_cache related prototypes
  */
Index: linux-2.6/mm/slub.c
===================================================================
--- linux-2.6.orig/mm/slub.c	2010-04-27 12:32:30.000000000 -0500
+++ linux-2.6/mm/slub.c	2010-04-27 12:33:37.000000000 -0500
@@ -1081,7 +1081,7 @@ static inline struct page *alloc_slab_pa
 
 	flags |= __GFP_NOTRACK;
 
-	if (node == -1)
+	if (node == SLAB_NODE_UNSPECIFIED)
 		return alloc_pages(flags, order);
 	else
 		return alloc_pages_node(node, flags, order);
@@ -1731,7 +1731,7 @@ static __always_inline void *slab_alloc(
 
 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, SLAB_NODE_UNSPECIFIED, _RET_IP_);
 
 	trace_kmem_cache_alloc(_RET_IP_, ret, s->objsize, s->size, gfpflags);
 
@@ -1742,7 +1742,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, SLAB_NODE_UNSPECIFIED, _RET_IP_);
 }
 EXPORT_SYMBOL(kmem_cache_alloc_notrace);
 #endif
@@ -2740,7 +2740,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, SLAB_NODE_UNSPECIFIED, _RET_IP_);
 
 	trace_kmalloc(_RET_IP_, ret, size, s->size, flags);
 
@@ -3324,7 +3324,7 @@ void *__kmalloc_track_caller(size_t size
 	if (unlikely(ZERO_OR_NULL_PTR(s)))
 		return s;
 
-	ret = slab_alloc(s, gfpflags, -1, caller);
+	ret = slab_alloc(s, gfpflags, SLAB_NODE_UNSPECIFIED, caller);
 
 	/* Honor the call site pointer we recieved. */
 	trace_kmalloc(caller, ret, size, s->size, gfpflags);

-- 

--
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:[~2010-05-14 18:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-14 18:39 [RFC SLEB 00/10] [RFC] SLEB: The Enhanced Slab Allocator Christoph Lameter
2010-05-14 18:39 ` Christoph Lameter [this message]
2010-05-14 18:39 ` [RFC SLEB 02/10] SLUB: Constants need UL Christoph Lameter
2010-05-14 18:39 ` [RFC SLEB 03/10] SLUB: Use kmem_cache flags to detect if Slab is in debugging mode Christoph Lameter
2010-05-14 18:39 ` [RFC SLEB 04/10] SLUB: discard_slab_unlock Christoph Lameter
2010-05-14 18:39 ` [RFC SLEB 05/10] SLUB: is_kmalloc_cache Christoph Lameter
2010-05-14 18:39 ` [RFC SLEB 06/10] SLEB: The Enhanced Slab Allocator Christoph Lameter
2010-05-14 18:39 ` [RFC SLEB 07/10] SLEB: Resize cpu queue Christoph Lameter
2010-05-14 18:39 ` [RFC SLEB 08/10] SLED: Get rid of useless function Christoph Lameter
2010-05-14 18:39 ` [RFC SLEB 09/10] SLEB: Remove MAX_OBJS limitation Christoph Lameter
2010-05-14 18:39 ` [RFC SLEB 10/10] SLEB: Add shared cache 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=20100514183942.782519323@quilx.com \
    --to=cl@linux.com \
    --cc=linux-mm@kvack.org \
    --cc=penberg@cs.helsinki.fi \
    /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;
as well as URLs for NNTP newsgroup(s).