Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 108107
b: refs/heads/master
c: 5595cff
h: refs/heads/master
i:
  108105: da66409
  108103: e0e1575
v: v3
  • Loading branch information
Pekka Enberg committed Aug 5, 2008
1 parent 0ba9881 commit 09ae561
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 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: 231367fd9bccbb36309ab5bf5012e11a84231031
refs/heads/master: 5595cffc8248e4672c5803547445e85e4053c8fc
1 change: 1 addition & 0 deletions trunk/include/linux/slub_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ struct kmem_cache_cpu {
struct kmem_cache_node {
spinlock_t list_lock; /* Protect partial list and nr_partial */
unsigned long nr_partial;
unsigned long min_partial;
struct list_head partial;
#ifdef CONFIG_SLUB_DEBUG
atomic_long_t nr_slabs;
Expand Down
26 changes: 19 additions & 7 deletions trunk/mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@ static struct page *get_any_partial(struct kmem_cache *s, gfp_t flags)
n = get_node(s, zone_to_nid(zone));

if (n && cpuset_zone_allowed_hardwall(zone, flags) &&
n->nr_partial > MIN_PARTIAL) {
n->nr_partial > n->min_partial) {
page = get_partial_node(n);
if (page)
return page;
Expand Down Expand Up @@ -1381,7 +1381,7 @@ static void unfreeze_slab(struct kmem_cache *s, struct page *page, int tail)
slab_unlock(page);
} else {
stat(c, DEACTIVATE_EMPTY);
if (n->nr_partial < MIN_PARTIAL) {
if (n->nr_partial < n->min_partial) {
/*
* Adding an empty slab to the partial slabs in order
* to avoid page allocator overhead. This slab needs
Expand Down Expand Up @@ -1913,9 +1913,21 @@ static void init_kmem_cache_cpu(struct kmem_cache *s,
#endif
}

static void init_kmem_cache_node(struct kmem_cache_node *n)
static void
init_kmem_cache_node(struct kmem_cache_node *n, struct kmem_cache *s)
{
n->nr_partial = 0;

/*
* The larger the object size is, the more pages we want on the partial
* list to avoid pounding the page allocator excessively.
*/
n->min_partial = ilog2(s->size);
if (n->min_partial < MIN_PARTIAL)
n->min_partial = MIN_PARTIAL;
else if (n->min_partial > MAX_PARTIAL)
n->min_partial = MAX_PARTIAL;

spin_lock_init(&n->list_lock);
INIT_LIST_HEAD(&n->partial);
#ifdef CONFIG_SLUB_DEBUG
Expand Down Expand Up @@ -2087,7 +2099,7 @@ static struct kmem_cache_node *early_kmem_cache_node_alloc(gfp_t gfpflags,
init_object(kmalloc_caches, n, 1);
init_tracking(kmalloc_caches, n);
#endif
init_kmem_cache_node(n);
init_kmem_cache_node(n, kmalloc_caches);
inc_slabs_node(kmalloc_caches, node, page->objects);

/*
Expand Down Expand Up @@ -2144,7 +2156,7 @@ static int init_kmem_cache_nodes(struct kmem_cache *s, gfp_t gfpflags)

}
s->node[node] = n;
init_kmem_cache_node(n);
init_kmem_cache_node(n, s);
}
return 1;
}
Expand All @@ -2155,7 +2167,7 @@ static void free_kmem_cache_nodes(struct kmem_cache *s)

static int init_kmem_cache_nodes(struct kmem_cache *s, gfp_t gfpflags)
{
init_kmem_cache_node(&s->local_node);
init_kmem_cache_node(&s->local_node, s);
return 1;
}
#endif
Expand Down Expand Up @@ -2889,7 +2901,7 @@ static int slab_mem_going_online_callback(void *arg)
ret = -ENOMEM;
goto out;
}
init_kmem_cache_node(n);
init_kmem_cache_node(n, s);
s->node[nid] = n;
}
out:
Expand Down

0 comments on commit 09ae561

Please sign in to comment.