SLUB: rename defrag to remote_node_defrag_ratio

The NUMA defrag works by allocating objects from partial slabs on remote
nodes. Rename it to

remote_node_defrag_ratio

to be clear about this.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

+13 -9
+4 -1
include/linux/slub_def.h
··· 59 #endif 60 61 #ifdef CONFIG_NUMA 62 - int defrag_ratio; 63 struct kmem_cache_node *node[MAX_NUMNODES]; 64 #endif 65 #ifdef CONFIG_SMP
··· 59 #endif 60 61 #ifdef CONFIG_NUMA 62 + /* 63 + * Defragmentation by allocating from a remote node. 64 + */ 65 + int remote_node_defrag_ratio; 66 struct kmem_cache_node *node[MAX_NUMNODES]; 67 #endif 68 #ifdef CONFIG_SMP
+9 -8
mm/slub.c
··· 1295 * expensive if we do it every time we are trying to find a slab 1296 * with available objects. 1297 */ 1298 - if (!s->defrag_ratio || get_cycles() % 1024 > s->defrag_ratio) 1299 return NULL; 1300 1301 zonelist = &NODE_DATA(slab_node(current->mempolicy)) ··· 2210 2211 s->refcount = 1; 2212 #ifdef CONFIG_NUMA 2213 - s->defrag_ratio = 100; 2214 #endif 2215 if (!init_kmem_cache_nodes(s, gfpflags & ~SLUB_DMA)) 2216 goto error; ··· 3848 SLAB_ATTR_RO(free_calls); 3849 3850 #ifdef CONFIG_NUMA 3851 - static ssize_t defrag_ratio_show(struct kmem_cache *s, char *buf) 3852 { 3853 - return sprintf(buf, "%d\n", s->defrag_ratio / 10); 3854 } 3855 3856 - static ssize_t defrag_ratio_store(struct kmem_cache *s, 3857 const char *buf, size_t length) 3858 { 3859 int n = simple_strtoul(buf, NULL, 10); 3860 3861 if (n < 100) 3862 - s->defrag_ratio = n * 10; 3863 return length; 3864 } 3865 - SLAB_ATTR(defrag_ratio); 3866 #endif 3867 3868 static struct attribute * slab_attrs[] = { ··· 3893 &cache_dma_attr.attr, 3894 #endif 3895 #ifdef CONFIG_NUMA 3896 - &defrag_ratio_attr.attr, 3897 #endif 3898 NULL 3899 };
··· 1295 * expensive if we do it every time we are trying to find a slab 1296 * with available objects. 1297 */ 1298 + if (!s->remote_node_defrag_ratio || 1299 + get_cycles() % 1024 > s->remote_node_defrag_ratio) 1300 return NULL; 1301 1302 zonelist = &NODE_DATA(slab_node(current->mempolicy)) ··· 2209 2210 s->refcount = 1; 2211 #ifdef CONFIG_NUMA 2212 + s->remote_node_defrag_ratio = 100; 2213 #endif 2214 if (!init_kmem_cache_nodes(s, gfpflags & ~SLUB_DMA)) 2215 goto error; ··· 3847 SLAB_ATTR_RO(free_calls); 3848 3849 #ifdef CONFIG_NUMA 3850 + static ssize_t remote_node_defrag_ratio_show(struct kmem_cache *s, char *buf) 3851 { 3852 + return sprintf(buf, "%d\n", s->remote_node_defrag_ratio / 10); 3853 } 3854 3855 + static ssize_t remote_node_defrag_ratio_store(struct kmem_cache *s, 3856 const char *buf, size_t length) 3857 { 3858 int n = simple_strtoul(buf, NULL, 10); 3859 3860 if (n < 100) 3861 + s->remote_node_defrag_ratio = n * 10; 3862 return length; 3863 } 3864 + SLAB_ATTR(remote_node_defrag_ratio); 3865 #endif 3866 3867 static struct attribute * slab_attrs[] = { ··· 3892 &cache_dma_attr.attr, 3893 #endif 3894 #ifdef CONFIG_NUMA 3895 + &remote_node_defrag_ratio_attr.attr, 3896 #endif 3897 NULL 3898 };