Subject: [PATCH 1/7] slub: Remove __slab_alloc code duplication

Somehow the two branches in __slab_alloc do the same.
Unify them.

Signed-off-by: Christoph Lameter <[email protected]>

Index: linux/mm/slub.c
===================================================================
--- linux.orig/mm/slub.c 2014-12-08 13:24:05.193185492 -0600
+++ linux/mm/slub.c 2014-12-09 12:23:11.927032128 -0600
@@ -2282,10 +2282,7 @@ redo:

if (unlikely(!node_match(page, searchnode))) {
stat(s, ALLOC_NODE_MISMATCH);
- deactivate_slab(s, page, c->freelist);
- c->page = NULL;
- c->freelist = NULL;
- goto new_slab;
+ goto deactivate;
}
}

@@ -2294,12 +2291,8 @@ redo:
* PFMEMALLOC but right now, we are losing the pfmemalloc
* information when the page leaves the per-cpu allocator
*/
- if (unlikely(!pfmemalloc_match(page, gfpflags))) {
- deactivate_slab(s, page, c->freelist);
- c->page = NULL;
- c->freelist = NULL;
- goto new_slab;
- }
+ if (unlikely(!pfmemalloc_match(page, gfpflags)))
+ goto deactivate;

/* must check again c->freelist in case of cpu migration or IRQ */
freelist = c->freelist;
@@ -2328,6 +2321,11 @@ load_freelist:
local_irq_restore(flags);
return freelist;

+deactivate:
+ deactivate_slab(s, page, c->freelist);
+ c->page = NULL;
+ c->freelist = NULL;
+
new_slab:

if (c->partial) {


2014-12-10 16:39:22

by Pekka Enberg

[permalink] [raw]
Subject: Re: [PATCH 1/7] slub: Remove __slab_alloc code duplication

On Wed, Dec 10, 2014 at 6:30 PM, Christoph Lameter <[email protected]> wrote:
> Somehow the two branches in __slab_alloc do the same.
> Unify them.
>
> Signed-off-by: Christoph Lameter <[email protected]>

Reviewed-by: Pekka Enberg <[email protected]>