[patch 02/10] SLUB: Noinline some functions to avoid them being folded into alloc/free

Christoph Lameter
2007-10-28T03:33:16Z

[-- Attachment #1: slub_noinline --]
[-- Type: text/plain, Size: 1807 bytes --]

Some function tend to get folded into __slab_free and __slab_alloc
although they are rarely called. They cause register pressure that
leads to bad code generation.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

---
mm/slub.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

Index: linux-2.6/mm/slub.c
===================================================================
--- linux-2.6.orig/mm/slub.c 2007-10-25 19:36:10.000000000 -0700
+++ linux-2.6/mm/slub.c 2007-10-25 19:36:59.000000000 -0700
@@ -831,8 +831,8 @@ static void setup_object_debug(struct km
init_tracking(s, object);
}

-static int alloc_debug_processing(struct kmem_cache *s, struct page *page,
- void *object, void *addr)
+static noinline int alloc_debug_processing(struct kmem_cache *s,
+ struct page *page, void *object, void *addr)
{
if (!check_slab(s, page))
goto bad;
@@ -871,8 +871,8 @@ bad:
return 0;
}

-static int free_debug_processing(struct kmem_cache *s, struct page *page,
- void *object, void *addr)
+static noinline int free_debug_processing(struct kmem_cache *s,
+ struct page *page, void *object, void *addr)
{
if (!check_slab(s, page))
goto fail;
@@ -1075,7 +1075,8 @@ static void setup_object(struct kmem_cac
s->ctor(s, object);
}

-static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node)
+static noinline struct page *new_slab(struct kmem_cache *s,
+ gfp_t flags, int node)
{
struct page *page;
struct kmem_cache_node *n;
@@ -1209,7 +1210,7 @@ static void add_partial(struct kmem_cach
spin_unlock(&n->list_lock);
}

-static void remove_partial(struct kmem_cache *s,
+static noinline void remove_partial(struct kmem_cache *s,
struct page *page)
{
struct kmem_cache_node *n = get_node(s, page_to_nid(page));

--