Commit 1ea991b0 authored by Joonsoo Kim's avatar Joonsoo Kim Committed by Pekka Enberg

slab: remove nodeid in struct slab

We can get nodeid using address translation, so this field is not useful.
Therefore, remove it.
Acked-by: default avatarAndi Kleen <ak@linux.intel.com>
Acked-by: default avatarChristoph Lameter <cl@linux.com>
Signed-off-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: default avatarPekka Enberg <penberg@iki.fi>
parent ac2b54ed
...@@ -222,7 +222,6 @@ struct slab { ...@@ -222,7 +222,6 @@ struct slab {
void *s_mem; /* including colour offset */ void *s_mem; /* including colour offset */
unsigned int inuse; /* num of objs active in slab */ unsigned int inuse; /* num of objs active in slab */
kmem_bufctl_t free; kmem_bufctl_t free;
unsigned short nodeid;
}; };
struct slab_rcu __slab_cover_slab_rcu; struct slab_rcu __slab_cover_slab_rcu;
}; };
...@@ -1099,8 +1098,7 @@ static void drain_alien_cache(struct kmem_cache *cachep, ...@@ -1099,8 +1098,7 @@ static void drain_alien_cache(struct kmem_cache *cachep,
static inline int cache_free_alien(struct kmem_cache *cachep, void *objp) static inline int cache_free_alien(struct kmem_cache *cachep, void *objp)
{ {
struct slab *slabp = virt_to_slab(objp); int nodeid = page_to_nid(virt_to_page(objp));
int nodeid = slabp->nodeid;
struct kmem_cache_node *n; struct kmem_cache_node *n;
struct array_cache *alien = NULL; struct array_cache *alien = NULL;
int node; int node;
...@@ -1111,7 +1109,7 @@ static inline int cache_free_alien(struct kmem_cache *cachep, void *objp) ...@@ -1111,7 +1109,7 @@ static inline int cache_free_alien(struct kmem_cache *cachep, void *objp)
* Make sure we are not freeing a object from another node to the array * Make sure we are not freeing a object from another node to the array
* cache on this cpu. * cache on this cpu.
*/ */
if (likely(slabp->nodeid == node)) if (likely(nodeid == node))
return 0; return 0;
n = cachep->node[node]; n = cachep->node[node];
...@@ -2630,7 +2628,6 @@ static struct slab *alloc_slabmgmt(struct kmem_cache *cachep, ...@@ -2630,7 +2628,6 @@ static struct slab *alloc_slabmgmt(struct kmem_cache *cachep,
} }
slabp->inuse = 0; slabp->inuse = 0;
slabp->s_mem = addr + colour_off; slabp->s_mem = addr + colour_off;
slabp->nodeid = nodeid;
slabp->free = 0; slabp->free = 0;
return slabp; return slabp;
} }
...@@ -2707,7 +2704,7 @@ static void *slab_get_obj(struct kmem_cache *cachep, struct slab *slabp, ...@@ -2707,7 +2704,7 @@ static void *slab_get_obj(struct kmem_cache *cachep, struct slab *slabp,
next = slab_bufctl(slabp)[slabp->free]; next = slab_bufctl(slabp)[slabp->free];
#if DEBUG #if DEBUG
slab_bufctl(slabp)[slabp->free] = BUFCTL_FREE; slab_bufctl(slabp)[slabp->free] = BUFCTL_FREE;
WARN_ON(slabp->nodeid != nodeid); WARN_ON(page_to_nid(virt_to_page(objp)) != nodeid);
#endif #endif
slabp->free = next; slabp->free = next;
...@@ -2721,7 +2718,7 @@ static void slab_put_obj(struct kmem_cache *cachep, struct slab *slabp, ...@@ -2721,7 +2718,7 @@ static void slab_put_obj(struct kmem_cache *cachep, struct slab *slabp,
#if DEBUG #if DEBUG
/* Verify that the slab belongs to the intended node */ /* Verify that the slab belongs to the intended node */
WARN_ON(slabp->nodeid != nodeid); WARN_ON(page_to_nid(virt_to_page(objp)) != nodeid);
if (slab_bufctl(slabp)[objnr] + 1 <= SLAB_LIMIT + 1) { if (slab_bufctl(slabp)[objnr] + 1 <= SLAB_LIMIT + 1) {
printk(KERN_ERR "slab: double free detected in cache " printk(KERN_ERR "slab: double free detected in cache "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment