Commit 5dfb4838 authored by Linus Torvalds's avatar Linus Torvalds

Cset exclude: mingo@elte.hu|ChangeSet|20020728030719|07783

parent 3f0c2c5b
......@@ -526,14 +526,10 @@ static void __init do_basic_setup(void)
static void do_pre_smp_initcalls(void)
{
#if CONFIG_SMP
extern int migration_init(void);
#endif
extern int spawn_ksoftirqd(void);
#if CONFIG_SMP
migration_init();
#endif
spawn_ksoftirqd();
}
......
......@@ -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 ]
......@@ -1961,29 +1957,6 @@ void set_cpus_allowed(task_t *p, unsigned long new_mask)
preempt_enable();
}
/*
* 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.
......@@ -1991,19 +1964,15 @@ static int migration_startup_thread(void * data)
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(&current->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, &param);
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment