Merge branch 'slub/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6

* 'slub/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6:
  SLUB: Allow full duplication of kmalloc array for 390
  slub: move kmem_cache_node into it's own cacheline
This commit is contained in:
Linus Torvalds 2010-05-30 12:46:17 -07:00
commit 3b03117c5c
2 changed files with 16 additions and 30 deletions

View File

@ -75,12 +75,6 @@ struct kmem_cache {
int offset; /* Free pointer offset. */ int offset; /* Free pointer offset. */
struct kmem_cache_order_objects oo; struct kmem_cache_order_objects oo;
/*
* Avoid an extra cache line for UP, SMP and for the node local to
* struct kmem_cache.
*/
struct kmem_cache_node local_node;
/* Allocation and freeing of slabs */ /* Allocation and freeing of slabs */
struct kmem_cache_order_objects max; struct kmem_cache_order_objects max;
struct kmem_cache_order_objects min; struct kmem_cache_order_objects min;
@ -102,6 +96,9 @@ struct kmem_cache {
*/ */
int remote_node_defrag_ratio; int remote_node_defrag_ratio;
struct kmem_cache_node *node[MAX_NUMNODES]; struct kmem_cache_node *node[MAX_NUMNODES];
#else
/* Avoid an extra cache line for UP */
struct kmem_cache_node local_node;
#endif #endif
}; };
@ -140,7 +137,7 @@ struct kmem_cache {
#ifdef CONFIG_ZONE_DMA #ifdef CONFIG_ZONE_DMA
#define SLUB_DMA __GFP_DMA #define SLUB_DMA __GFP_DMA
/* Reserve extra caches for potential DMA use */ /* Reserve extra caches for potential DMA use */
#define KMALLOC_CACHES (2 * SLUB_PAGE_SHIFT - 6) #define KMALLOC_CACHES (2 * SLUB_PAGE_SHIFT)
#else #else
/* Disable DMA functionality */ /* Disable DMA functionality */
#define SLUB_DMA (__force gfp_t)0 #define SLUB_DMA (__force gfp_t)0

View File

@ -2137,7 +2137,7 @@ static void free_kmem_cache_nodes(struct kmem_cache *s)
for_each_node_state(node, N_NORMAL_MEMORY) { for_each_node_state(node, N_NORMAL_MEMORY) {
struct kmem_cache_node *n = s->node[node]; struct kmem_cache_node *n = s->node[node];
if (n && n != &s->local_node) if (n)
kmem_cache_free(kmalloc_caches, n); kmem_cache_free(kmalloc_caches, n);
s->node[node] = NULL; s->node[node] = NULL;
} }
@ -2146,33 +2146,22 @@ static void free_kmem_cache_nodes(struct kmem_cache *s)
static int init_kmem_cache_nodes(struct kmem_cache *s, gfp_t gfpflags) static int init_kmem_cache_nodes(struct kmem_cache *s, gfp_t gfpflags)
{ {
int node; int node;
int local_node;
if (slab_state >= UP && (s < kmalloc_caches ||
s >= kmalloc_caches + KMALLOC_CACHES))
local_node = page_to_nid(virt_to_page(s));
else
local_node = 0;
for_each_node_state(node, N_NORMAL_MEMORY) { for_each_node_state(node, N_NORMAL_MEMORY) {
struct kmem_cache_node *n; struct kmem_cache_node *n;
if (local_node == node) if (slab_state == DOWN) {
n = &s->local_node; early_kmem_cache_node_alloc(gfpflags, node);
else { continue;
if (slab_state == DOWN) {
early_kmem_cache_node_alloc(gfpflags, node);
continue;
}
n = kmem_cache_alloc_node(kmalloc_caches,
gfpflags, node);
if (!n) {
free_kmem_cache_nodes(s);
return 0;
}
} }
n = kmem_cache_alloc_node(kmalloc_caches,
gfpflags, node);
if (!n) {
free_kmem_cache_nodes(s);
return 0;
}
s->node[node] = n; s->node[node] = n;
init_kmem_cache_node(n, s); init_kmem_cache_node(n, s);
} }