lkml.org 
[lkml]   [2005]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: NUMA aware slab allocator V3
On Wed, 18 May 2005, Matthew Dobson wrote:

> I can't promise anything, but if you send me the latest version of your
> patch (preferably with the loops fixed to eliminate the possibility of it
> accessing an unavailable/unusable node), I can build & boot it on a PPC64
> box and see what happens.

Ok. Maybe one of the other issues addressed will fix the issue.

------------------

Fixes to the slab allocator in 2.6.12-rc4-mm2

- Remove MAX_NUMNODES check
- use for_each_node/cpu
- Fix determination of INDEX_AC

Signed-off-by: Christoph Lameter <christoph@lameter.com>
Signed-off-by: Alok N Kataria <alokk@calsoftinc.com>

Index: linux-2.6.12-rc4/mm/slab.c
===================================================================
--- linux-2.6.12-rc4.orig/mm/slab.c 2005-05-17 02:20:02.000000000 +0000
+++ linux-2.6.12-rc4/mm/slab.c 2005-05-18 21:36:51.000000000 +0000
@@ -108,17 +108,6 @@
#include <asm/page.h>

/*
- * Some Linux kernels currently have weird notions of NUMA. Make sure that
- * there is only a single node if CONFIG_NUMA is not set. Remove this check
- * after the situation has stabilized.
- */
-#ifndef CONFIG_NUMA
-#if MAX_NUMNODES != 1
-#error "Broken Configuration: CONFIG_NUMA not set but MAX_NUMNODES !=1 !!"
-#endif
-#endif
-
-/*
* DEBUG - 1 for kmem_cache_create() to honour; SLAB_DEBUG_INITIAL,
* SLAB_RED_ZONE & SLAB_POISON.
* 0 for faster, smaller code (especially in the critical paths).
@@ -341,7 +330,7 @@
}
}

-#define INDEX_AC index_of(sizeof(struct array_cache))
+#define INDEX_AC index_of(sizeof(struct arraycache_init))
#define INDEX_L3 index_of(sizeof(struct kmem_list3))

#ifdef CONFIG_NUMA
@@ -800,7 +789,7 @@
limit = 12;
ac_ptr = kmalloc_node(memsize, GFP_KERNEL, node);
if (ac_ptr) {
- for (i = 0; i < MAX_NUMNODES; i++) {
+ for_each_node(i) {
if (i == node) {
ac_ptr[i] = NULL;
continue;
@@ -823,7 +812,7 @@

if (!ac_ptr)
return;
- for (i = 0; i < MAX_NUMNODES; i++)
+ for_each_node(i)
kfree(ac_ptr[i]);

kfree(ac_ptr);
@@ -847,7 +836,7 @@
struct array_cache *ac;
unsigned long flags;

- for (i = 0; i < MAX_NUMNODES; i++) {
+ for_each_node(i) {
ac = l3->alien[i];
if (ac) {
spin_lock_irqsave(&ac->lock, flags);
@@ -1197,7 +1186,7 @@
* Register the timers that return unneeded
* pages to gfp.
*/
- for (cpu = 0; cpu < NR_CPUS; cpu++) {
+ for_each_cpu(cpu) {
if (cpu_online(cpu))
start_cpu_timer(cpu);
}
@@ -1986,7 +1975,7 @@
drain_cpu_caches(cachep);

check_irq_on();
- for (i = 0; i < MAX_NUMNODES; i++) {
+ for_each_node(i) {
l3 = cachep->nodelists[i];
if (l3) {
spin_lock_irq(&l3->list_lock);
@@ -2064,11 +2053,11 @@
/* no cpu_online check required here since we clear the percpu
* array on cpu offline and set this to NULL.
*/
- for (i = 0; i < NR_CPUS; i++)
+ for_each_cpu(i)
kfree(cachep->array[i]);

/* NUMA: free the list3 structures */
- for (i = 0; i < MAX_NUMNODES; i++) {
+ for_each_node(i) {
if ((l3 = cachep->nodelists[i])) {
kfree(l3->shared);
#ifdef CONFIG_NUMA
@@ -2975,7 +2964,7 @@
if (!pdata)
return NULL;

- for (i = 0; i < NR_CPUS; i++) {
+ for_each_cpu(i) {
if (!cpu_possible(i))
continue;
pdata->ptrs[i] = kmalloc_node(size, GFP_KERNEL,
@@ -3075,7 +3064,7 @@
int i;
struct percpu_data *p = (struct percpu_data *) (~(unsigned long) objp);

- for (i = 0; i < NR_CPUS; i++) {
+ for_each_cpu(i) {
if (!cpu_possible(i))
continue;
kfree(p->ptrs[i]);
@@ -3189,7 +3178,7 @@
struct kmem_list3 *l3;
int err = 0;

- for (i = 0; i < NR_CPUS; i++) {
+ for_each_cpu(i) {
if (cpu_online(i)) {
struct array_cache *nc = NULL, *new;
#ifdef CONFIG_NUMA
@@ -3280,7 +3269,7 @@
int i, err;

memset(&new.new,0,sizeof(new.new));
- for (i = 0; i < NR_CPUS; i++) {
+ for_each_cpu(i) {
if (cpu_online(i)) {
new.new[i] = alloc_arraycache(i, limit, batchcount);
if (!new.new[i]) {
@@ -3302,7 +3291,7 @@
cachep->shared = shared;
spin_unlock_irq(&cachep->spinlock);

- for (i = 0; i < NR_CPUS; i++) {
+ for_each_cpu(i) {
struct array_cache *ccold = new.new[i];
if (!ccold)
continue;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-05-18 23:45    [W:0.086 / U:0.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site