(2/3) Initial load balancing
Subsystems (3)
PATCH 1/1 (2/3) Initial load balancing
Patch from Michael Hohnbaum
This adds a hook, sched_balance_exec(), to the exec code, to make it place the exec'ed task on the least loaded queue. We have less state to move at exec time than fork time, so this is the cheapest point to cross-node migrate. Experience in Dynix/PTX and testing on Linux has confirmed that this is the cheapest time to move tasks between nodes.
It also macro-wraps changes to nr_running, to allow us to keep track of per-node nr_running as well. Again, no impact on non-NUMA machines.
fs/exec.c +2 -0
@@ -1031,6 +1031,8 @@ int do_execve(char * filename, char ** aint retval;int i; +sched_balance_exec (); + file =open_exec (filename); retval =PTR_ERR (file);
include/linux/sched.h +8 -0
@@ -444,6 +444,14 @@ extern void set_cpus_allowed(task_t *p,# define set_cpus_allowed (p, new_mask) do { } while (0)#endif +#ifdef CONFIG_NUMA +extern void sched_balance_exec (void ); +extern void node_nr_running_init (void ); +#else +#define sched_balance_exec () {} +#define node_nr_running_init () {} +#endif +extern void set_user_nice (task_t *p,long nice);extern int task_prio (task_t *p);extern int task_nice (task_t *p);
init/main.c +1 -0
@@ -495,6 +495,7 @@ static void do_pre_smp_initcalls(void)migration_init ();#endif +node_nr_running_init ();spawn_ksoftirqd (); }
kernel/sched.c +116 -6
165 lines not on this page · raw message