From: Christoph Lameter <clameter@sgi.com>
To: akpm@osdl.org
Cc: Pekka Enberg <penberg@cs.helsinki.fi>,
Marcelo Tosatti <marcelo@kvack.org>,
linux-kernel@vger.kernel.org,
Nick Piggin <nickpiggin@yahoo.com.au>,
linux-mm@kvack.org, Christoph Lameter <clameter@sgi.com>,
mpm@selenic.com, Manfred Spraul <manfred@colorfullife.com>,
Dave Chinner <dgc@sgi.com>, Andi Kleen <ak@suse.de>
Subject: [MODSLAB] Bypass indirections [for performance testing only]
Date: Fri, 1 Sep 2006 15:34:29 -0700 (PDT) [thread overview]
Message-ID: <20060901223429.21034.73197.sendpatchset@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20060901223358.21034.83736.sendpatchset@schroedinger.engr.sgi.com>
Bypass indirections.
This is a patch to bypass indirections so that one can get some statistics
on how high the impact of the indirect calls is.
Only use this for testing.
Index: linux-2.6.18-rc5-mm1/mm/slabifier.c
===================================================================
--- linux-2.6.18-rc5-mm1.orig/mm/slabifier.c 2006-09-01 14:25:55.907938735 -0700
+++ linux-2.6.18-rc5-mm1/mm/slabifier.c 2006-09-01 15:20:51.915297648 -0700
@@ -498,12 +498,13 @@ gotpage:
goto redo;
}
-static void *slab_alloc(struct slab_cache *sc, gfp_t gfpflags)
+void *slab_alloc(struct slab_cache *sc, gfp_t gfpflags)
{
return __slab_alloc(sc, gfpflags, -1);
}
+EXPORT_SYMBOL(slab_alloc);
-static void *slab_alloc_node(struct slab_cache *sc, gfp_t gfpflags,
+void *slab_alloc_node(struct slab_cache *sc, gfp_t gfpflags,
int node)
{
#ifdef CONFIG_NUMA
@@ -512,8 +513,9 @@ static void *slab_alloc_node(struct slab
return slab_alloc(sc, gfpflags);
#endif
}
+EXPORT_SYMBOL(slab_alloc_node);
-static void slab_free(struct slab_cache *sc, const void *x)
+void slab_free(struct slab_cache *sc, const void *x)
{
struct slab *s = (void *)sc;
struct page * page;
@@ -617,6 +619,7 @@ dumpret:
return;
#endif
}
+EXPORT_SYMBOL(slab_free);
/* Figure out on which slab object the object resides */
static __always_inline struct page *get_object_page(const void *x)
Index: linux-2.6.18-rc5-mm1/include/linux/kmalloc.h
===================================================================
--- linux-2.6.18-rc5-mm1.orig/include/linux/kmalloc.h 2006-09-01 14:26:06.439513840 -0700
+++ linux-2.6.18-rc5-mm1/include/linux/kmalloc.h 2006-09-01 15:20:51.917250652 -0700
@@ -67,6 +67,10 @@ static inline int kmalloc_index(int size
return -1;
}
+extern void *slab_alloc(struct slab_cache *, gfp_t flags);
+extern void *slab_alloc_node(struct slab_cache *, gfp_t, int);
+extern void slab_free(struct slab_cache *, const void *);
+
/*
* Find the slab cache for a given combination of allocation flags and size.
*
@@ -96,7 +100,7 @@ static inline void *kmalloc(size_t size,
if (__builtin_constant_p(size) && !(flags & __GFP_DMA)) {
struct slab_cache *s = kmalloc_slab(size);
- return KMALLOC_ALLOCATOR.alloc(s, flags);
+ return slab_alloc(s, flags);
} else
return __kmalloc(size, flags);
}
@@ -108,7 +112,7 @@ static inline void *kmalloc_node(size_t
if (__builtin_constant_p(size) && !(flags & __GFP_DMA)) {
struct slab_cache *s = kmalloc_slab(size);
- return KMALLOC_ALLOCATOR.alloc_node(s, flags, node);
+ return slab_alloc_node(s, flags, node);
} else
return __kmalloc_node(size, flags, node);
}
@@ -119,7 +123,7 @@ static inline void *kmalloc_node(size_t
/* Free an object */
static inline void kfree(const void *x)
{
- return KMALLOC_ALLOCATOR.free(NULL, x);
+ slab_free(NULL, x);
}
/* Allocate and zero the specified number of bytes */
Index: linux-2.6.18-rc5-mm1/mm/kmalloc.c
===================================================================
--- linux-2.6.18-rc5-mm1.orig/mm/kmalloc.c 2006-09-01 14:26:06.440490342 -0700
+++ linux-2.6.18-rc5-mm1/mm/kmalloc.c 2006-09-01 15:20:51.917250652 -0700
@@ -124,15 +124,14 @@ static struct slab_cache *get_slab(size_
void *__kmalloc(size_t size, gfp_t flags)
{
- return KMALLOC_ALLOCATOR.alloc(get_slab(size, flags), flags);
+ return slab_alloc(get_slab(size, flags), flags);
}
EXPORT_SYMBOL(__kmalloc);
#ifdef CONFIG_NUMA
void *__kmalloc_node(size_t size, gfp_t flags, int node)
{
- return KMALLOC_ALLOCATOR.alloc_node(get_slab(size, flags),
- flags, node);
+ return slab_alloc_node(get_slab(size, flags), flags, node);
}
EXPORT_SYMBOL(__kmalloc_node);
#endif
Index: linux-2.6.18-rc5-mm1/include/linux/slabulator.h
===================================================================
--- linux-2.6.18-rc5-mm1.orig/include/linux/slabulator.h 2006-09-01 14:26:06.861362745 -0700
+++ linux-2.6.18-rc5-mm1/include/linux/slabulator.h 2006-09-01 15:20:51.918227155 -0700
@@ -73,20 +73,23 @@ static inline const char *kmem_cache_nam
static inline void *kmem_cache_alloc(struct slab_cache *s, gfp_t flags)
{
- return SLABULATOR_ALLOCATOR.alloc(s, flags);
+ return slab_alloc(s, flags);
+ //return SLABULATOR_ALLOCATOR.alloc(s, flags);
}
static inline void *kmem_cache_alloc_node(struct slab_cache *s,
gfp_t flags, int node)
{
- return SLABULATOR_ALLOCATOR.alloc_node(s, flags, node);
+ return slab_alloc_node(s, flags, node);
+// return SLABULATOR_ALLOCATOR.alloc_node(s, flags, node);
}
extern void *kmem_cache_zalloc(struct slab_cache *s, gfp_t flags);
static inline void kmem_cache_free(struct slab_cache *s, const void *x)
{
- SLABULATOR_ALLOCATOR.free(s, x);
+ slab_free(s, x);
+// SLABULATOR_ALLOCATOR.free(s, x);
}
static inline int kmem_ptr_validate(struct slab_cache *s, void *x)
--
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>
prev parent reply other threads:[~2006-09-01 22:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-01 22:33 [MODSLAB 0/5] Modular slab allocator V3 Christoph Lameter
2006-09-01 22:34 ` [MODSLAB 1/5] Generic Allocator Framework Christoph Lameter
2006-09-01 22:34 ` [MODSLAB 2/5] Slabifier Christoph Lameter
2006-09-01 22:34 ` [MODSLAB 3/5] /proc/slabinfo display Christoph Lameter
2006-09-01 22:34 ` [MODSLAB 4/5] Kmalloc subsystem Christoph Lameter
2006-09-01 22:34 ` [MODSLAB 5/5] Slabulator: Emulate the existing Slab Layer Christoph Lameter
2006-09-01 22:34 ` Christoph Lameter [this message]
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=20060901223429.21034.73197.sendpatchset@schroedinger.engr.sgi.com \
--to=clameter@sgi.com \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=dgc@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=manfred@colorfullife.com \
--cc=marcelo@kvack.org \
--cc=mpm@selenic.com \
--cc=nickpiggin@yahoo.com.au \
--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