Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 82919
b: refs/heads/master
c: 9824601
h: refs/heads/master
i:
  82917: a855511
  82915: 75f893a
  82911: 38fdb78
v: v3
  • Loading branch information
Christoph Lameter committed Feb 4, 2008
1 parent 46a753b commit ef5e141
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f61396aed90acb033952531c522d1010f87e24f4
refs/heads/master: 9824601ead957a29e35d539e43266c003f7b085b
5 changes: 4 additions & 1 deletion trunk/include/linux/slub_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ struct kmem_cache {
#endif

#ifdef CONFIG_NUMA
int defrag_ratio;
/*
* Defragmentation by allocating from a remote node.
*/
int remote_node_defrag_ratio;
struct kmem_cache_node *node[MAX_NUMNODES];
#endif
#ifdef CONFIG_SMP
Expand Down
17 changes: 9 additions & 8 deletions trunk/mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,8 @@ static struct page *get_any_partial(struct kmem_cache *s, gfp_t flags)
* expensive if we do it every time we are trying to find a slab
* with available objects.
*/
if (!s->defrag_ratio || get_cycles() % 1024 > s->defrag_ratio)
if (!s->remote_node_defrag_ratio ||
get_cycles() % 1024 > s->remote_node_defrag_ratio)
return NULL;

zonelist = &NODE_DATA(slab_node(current->mempolicy))
Expand Down Expand Up @@ -2209,7 +2210,7 @@ static int kmem_cache_open(struct kmem_cache *s, gfp_t gfpflags,

s->refcount = 1;
#ifdef CONFIG_NUMA
s->defrag_ratio = 100;
s->remote_node_defrag_ratio = 100;
#endif
if (!init_kmem_cache_nodes(s, gfpflags & ~SLUB_DMA))
goto error;
Expand Down Expand Up @@ -3847,21 +3848,21 @@ static ssize_t free_calls_show(struct kmem_cache *s, char *buf)
SLAB_ATTR_RO(free_calls);

#ifdef CONFIG_NUMA
static ssize_t defrag_ratio_show(struct kmem_cache *s, char *buf)
static ssize_t remote_node_defrag_ratio_show(struct kmem_cache *s, char *buf)
{
return sprintf(buf, "%d\n", s->defrag_ratio / 10);
return sprintf(buf, "%d\n", s->remote_node_defrag_ratio / 10);
}

static ssize_t defrag_ratio_store(struct kmem_cache *s,
static ssize_t remote_node_defrag_ratio_store(struct kmem_cache *s,
const char *buf, size_t length)
{
int n = simple_strtoul(buf, NULL, 10);

if (n < 100)
s->defrag_ratio = n * 10;
s->remote_node_defrag_ratio = n * 10;
return length;
}
SLAB_ATTR(defrag_ratio);
SLAB_ATTR(remote_node_defrag_ratio);
#endif

static struct attribute * slab_attrs[] = {
Expand Down Expand Up @@ -3892,7 +3893,7 @@ static struct attribute * slab_attrs[] = {
&cache_dma_attr.attr,
#endif
#ifdef CONFIG_NUMA
&defrag_ratio_attr.attr,
&remote_node_defrag_ratio_attr.attr,
#endif
NULL
};
Expand Down

0 comments on commit ef5e141

Please sign in to comment.