Skip to contentSkip to conversation

node affine NUMA scheduler 1/5

PATCH New Erich Focht 1 participant 1 message Oct 14, 2002 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 node affine NUMA scheduler 1/5

I resend these because for some unknown reason they don't seem to have made it neither into the MARC archives nor into those at www.cs.helsinki.fi

---------- Resent Message ----------

Subject: [PATCH] node affine NUMA scheduler 1/5
Date: Fri, 11 Oct 2002 19:54:30 +0200

Hi,

here comes the complete set of patches for the node affine NUMA scheduler. It's made of several building blocks and one can make several flavors of NUMA schedulers out of the patches.

The patches are:

01-numa_sched_core-2.5.39-10.patch :
Provides basic NUMA functionality. It implements CPU pools with all the mess needed to initialize them. Also it has a node aware find_busiest_queue() which first scans the own node for more loaded CPUs. If no steal candidate is found on the own node, it finds the most loaded node and tries to steal a task from it. By steal delays for remote node steals it tries to achieve equal node load. These delays can be extended to cope with multi-level node hierarchies (that patch is not included).

02-numa_sched_ilb-2.5.39-10.patch :
This patch provides simple initial load balancing during exec(). It is node aware and will select the least loaded node. Also it does a round-robin initial node selection to distribute the load better across the nodes.

03-node_affine-2.5.39-10.patch :
This is the heart of the node affine part of the patch. Tasks are assigned a homenode during initial load balancing and they are attracted to the homenode.

04-alloc_on_homenode.patch :
Coupling with the memory allocator: for user tasks allocate memory from the homenode, no matter on which node the task is scheduled.

05-dynamic_homenode-2.5.39-10.patch :
Dynamic homenode selection. When pages are allocated or freed they are tracked. The homenode is recalculated dynamically and set to the node where most of the memory of the task is allocated.

Meaningfull combinations of patches are:

A : numa scheduler : 01 + 02 node aware NUMA scheduler, with initial load
balancing
B : node affine scheduler : 01 + 02 + 03 (+04)

C : node affine scheduler with dynamic homenode selection :

      01 + 02 + 03 + 05 ( !exclude 04 !)

The best results should be provided by C as it incorporates most of the features.

The patches should run on ia32 NUMAQ and ia64 Azusa (with the topology patches applied). Other architectures just need the build_node() call similar to arch/i386/kernel/smpboot.c The issues with NUMAQ (uninitialized platform specific stuff) should be solved.

Comments, flames, etc... welcome ;-)

Best regards,
Erich

arch/i386/kernel/smpboot.c +3 -0
diff -urNp a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
@@ -1194,6 +1194,9 @@ int __devinit __cpu_up(unsigned int cpu)
 void __init smp_cpus_done(unsigned int max_cpus)
 {
 	zap_low_mappings();
+#ifdef CONFIG_NUMA
+	build_pools();
+#endif
 }
 
 void __init smp_intr_init()
arch/ia64/kernel/smpboot.c +4 -1
diff -urNp a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
@@ -397,7 +397,7 @@ unsigned long cache_decay_ticks;	/* # of
 static void
 smp_tune_scheduling (void)
 {
-	cache_decay_ticks = 10;	/* XXX base this on PAL info and cache-bandwidth estimate */
+	cache_decay_ticks = 8;	/* XXX base this on PAL info and cache-bandwidth estimate */
 
 	printk("task migration cache decay timeout: %ld msecs.\n",
 	       (cache_decay_ticks + 1) * 1000 / HZ);
@@ -508,6 +508,9 @@ smp_cpus_done (unsigned int dummy)
 
 	printk(KERN_INFO"Total of %d processors activated (%lu.%02lu BogoMIPS).\n",
 	       num_online_cpus(), bogosum/(500000/HZ), (bogosum/(5000/HZ))%100);
+#ifdef CONFIG_NUMA
+	build_pools();
+#endif
 }
 
 int __devinit
include/linux/sched.h +8 -1
diff -urNp a/include/linux/sched.h b/include/linux/sched.h
@@ -22,6 +22,7 @@ extern unsigned long event;
 #include <asm/mmu.h>
 
 #include <linux/smp.h>
+#include <asm/topology.h>
 #include <linux/sem.h>
 #include <linux/signal.h>
 #include <linux/securebits.h>
@@ -167,7 +168,6 @@ extern void update_one_process(struct ta
 extern void scheduler_tick(int user_tick, int system);
 extern unsigned long cache_decay_ticks;
 
-
 #define	MAX_SCHEDULE_TIMEOUT	LONG_MAX
 extern signed long FASTCALL(schedule_timeout(signed long timeout));
 asmlinkage void schedule(void);
@@ -457,6 +457,13 @@ extern void set_cpus_allowed(task_t *p, 
 # define set_cpus_allowed(p, new_mask) do { } while (0)
 #endif
 
+#ifdef CONFIG_NUMA
+extern void build_pools(void);
+extern void pooldata_lock(void);
+extern void pooldata_unlock(void);
+#endif
+extern void sched_migrate_task(task_t *p, int cpu);
+
 extern void set_user_nice(task_t *p, long nice);
 extern int task_prio(task_t *p);
 extern int task_nice(task_t *p);
kernel/sched.c +352 -127

584 lines not on this page · raw message