diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2008-02-10 05:21:54 -0500 |
---|---|---|
committer | Christoph Lameter <christoph@stapp.engr.sgi.com> | 2008-02-14 18:30:01 -0500 |
commit | e51bfd0ad10600a9fe4c8ede5ac2272e80075008 (patch) | |
tree | a204156fbb0036fb76e89ceffa15a30e90bc3f75 | |
parent | e760e716d47b48caf98da348368fd41b4a9b9e7e (diff) |
slab: avoid double initialization & do initialization in 1 place
- alloc_slabmgmt: initialize all slab fields in 1 place
- slab->nodeid was initialized twice: in alloc_slabmgmt
and immediately after it in cache_grow
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
CC: Christoph Lameter <clameter@sgi.com>
Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
-rw-r--r-- | mm/slab.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -2630,6 +2630,7 @@ static struct slab *alloc_slabmgmt(struct kmem_cache *cachep, void *objp, | |||
2630 | slabp->colouroff = colour_off; | 2630 | slabp->colouroff = colour_off; |
2631 | slabp->s_mem = objp + colour_off; | 2631 | slabp->s_mem = objp + colour_off; |
2632 | slabp->nodeid = nodeid; | 2632 | slabp->nodeid = nodeid; |
2633 | slabp->free = 0; | ||
2633 | return slabp; | 2634 | return slabp; |
2634 | } | 2635 | } |
2635 | 2636 | ||
@@ -2683,7 +2684,6 @@ static void cache_init_objs(struct kmem_cache *cachep, | |||
2683 | slab_bufctl(slabp)[i] = i + 1; | 2684 | slab_bufctl(slabp)[i] = i + 1; |
2684 | } | 2685 | } |
2685 | slab_bufctl(slabp)[i - 1] = BUFCTL_END; | 2686 | slab_bufctl(slabp)[i - 1] = BUFCTL_END; |
2686 | slabp->free = 0; | ||
2687 | } | 2687 | } |
2688 | 2688 | ||
2689 | static void kmem_flagcheck(struct kmem_cache *cachep, gfp_t flags) | 2689 | static void kmem_flagcheck(struct kmem_cache *cachep, gfp_t flags) |
@@ -2816,7 +2816,6 @@ static int cache_grow(struct kmem_cache *cachep, | |||
2816 | if (!slabp) | 2816 | if (!slabp) |
2817 | goto opps1; | 2817 | goto opps1; |
2818 | 2818 | ||
2819 | slabp->nodeid = nodeid; | ||
2820 | slab_map_pages(cachep, slabp, objp); | 2819 | slab_map_pages(cachep, slabp, objp); |
2821 | 2820 | ||
2822 | cache_init_objs(cachep, slabp); | 2821 | cache_init_objs(cachep, slabp); |