diff options
| author | Linus Torvalds <torvalds@home.transmeta.com> | 2002-07-28 09:07:37 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-07-28 09:07:37 -0700 |
| commit | 5dfb48389624a8294dfadd60adcf016c90c7d6a7 (patch) | |
| tree | e588f505845a787018450d24e0f670c8e85b2485 /kernel | |
| parent | 3f0c2c5bf51916b997219be6e06c2aa61da0b5c7 (diff) | |
Cset exclude: mingo@elte.hu|ChangeSet|20020728030719|07783
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/sched.c | 65 |
1 files changed, 11 insertions, 54 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index fdf4f8bd7baf..12e54306d4c0 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -16,23 +16,19 @@ * by Davide Libenzi, preemptible kernel bits by Robert Love. */ -#define __KERNEL_SYSCALLS__ - #include <linux/mm.h> #include <linux/nmi.h> #include <linux/init.h> -#include <linux/delay.h> -#include <linux/unistd.h> +#include <asm/uaccess.h> #include <linux/highmem.h> -#include <linux/security.h> -#include <linux/notifier.h> #include <linux/smp_lock.h> +#include <asm/mmu_context.h> #include <linux/interrupt.h> #include <linux/completion.h> #include <linux/kernel_stat.h> - -#include <asm/uaccess.h> -#include <asm/mmu_context.h> +#include <linux/security.h> +#include <linux/notifier.h> +#include <linux/delay.h> /* * Convert user-nice values [ -20 ... 0 ... 19 ] @@ -1962,48 +1958,21 @@ out: } /* - * The migration thread startup relies on the following property - * of set_cpus_allowed(): if the thread is not running currently - * then we can just put it into the target runqueue. - */ -DECLARE_MUTEX_LOCKED(migration_startup); - -typedef struct migration_startup_data { - int cpu; - task_t *thread; -} migration_startup_t; - -static int migration_startup_thread(void * data) -{ - migration_startup_t *startup = data; - - wait_task_inactive(startup->thread); - set_cpus_allowed(startup->thread, 1UL << startup->cpu); - up(&migration_startup); - - return 0; -} - -/* * migration_thread - this is a highprio system thread that performs * thread migration by 'pulling' threads into the target runqueue. */ static int migration_thread(void * data) { struct sched_param param = { sched_priority: MAX_RT_PRIO-1 }; - migration_startup_t startup; int cpu = (long) data; runqueue_t *rq; - int ret, pid; + int ret; daemonize(); sigfillset(¤t->blocked); set_fs(KERNEL_DS); - startup.cpu = cpu; - startup.thread = current; - pid = kernel_thread(migration_startup_thread, &startup, - CLONE_FS | CLONE_FILES | CLONE_SIGNAL); + set_cpus_allowed(current, 1UL << cpu); /* * Migration can happen without a migration thread on the @@ -2011,18 +1980,7 @@ static int migration_thread(void * data) * runqueue and the helper thread then moves this thread * to the target CPU - we'll wake up there. */ - down(&migration_startup); - - /* we need to waitpid() to release the helper thread */ - waitpid(pid, NULL, __WCLONE); - - /* - * At this point the startup helper thread must have - * migrated us to the proper CPU already: - */ if (smp_processor_id() != cpu) - BUG(); - printk("migration_task %d on cpu=%d\n", cpu, smp_processor_id()); ret = setscheduler(0, SCHED_FIFO, ¶m); @@ -2087,14 +2045,13 @@ static int migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu) { - unsigned long cpu = (unsigned long)hcpu; - switch (action) { case CPU_ONLINE: - printk("Starting migration thread for cpu %li\n", cpu); - kernel_thread(migration_thread, (void *)cpu, + printk("Starting migration thread for cpu %li\n", + (long)hcpu); + kernel_thread(migration_thread, hcpu, CLONE_FS | CLONE_FILES | CLONE_SIGNAL); - while (!cpu_rq(cpu)->migration_thread) + while (!cpu_rq((long)hcpu)->migration_thread) yield(); break; } |
