diff options
author | Keith Owens <kaos@sgi.com> | 2005-09-11 03:19:06 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2005-09-11 17:01:30 -0400 |
commit | a2a979821b6ab75a4f143cfaa1c4672cc259ec10 (patch) | |
tree | 4e327a4a8c14829d4addf8a09e13355e0cf565a4 | |
parent | 9fe66dfd8846706ff11ed7990d06c92644973bd8 (diff) |
[PATCH] MCA/INIT: scheduler hooks
Scheduler hooks to see/change which process is deemed to be on a cpu.
Signed-off-by: Keith Owens <kaos@sgi.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
-rw-r--r-- | include/linux/sched.h | 2 | ||||
-rw-r--r-- | kernel/sched.c | 26 |
2 files changed, 28 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 4b83cb230006..ed3bb19d1337 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -904,6 +904,8 @@ extern int task_curr(const task_t *p); | |||
904 | extern int idle_cpu(int cpu); | 904 | extern int idle_cpu(int cpu); |
905 | extern int sched_setscheduler(struct task_struct *, int, struct sched_param *); | 905 | extern int sched_setscheduler(struct task_struct *, int, struct sched_param *); |
906 | extern task_t *idle_task(int cpu); | 906 | extern task_t *idle_task(int cpu); |
907 | extern task_t *curr_task(int cpu); | ||
908 | extern void set_curr_task(int cpu, task_t *p); | ||
907 | 909 | ||
908 | void yield(void); | 910 | void yield(void); |
909 | 911 | ||
diff --git a/kernel/sched.c b/kernel/sched.c index dbd4490afec1..e9ff04a9b56d 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -3577,6 +3577,32 @@ task_t *idle_task(int cpu) | |||
3577 | } | 3577 | } |
3578 | 3578 | ||
3579 | /** | 3579 | /** |
3580 | * curr_task - return the current task for a given cpu. | ||
3581 | * @cpu: the processor in question. | ||
3582 | */ | ||
3583 | task_t *curr_task(int cpu) | ||
3584 | { | ||
3585 | return cpu_curr(cpu); | ||
3586 | } | ||
3587 | |||
3588 | /** | ||
3589 | * set_curr_task - set the current task for a given cpu. | ||
3590 | * @cpu: the processor in question. | ||
3591 | * @p: the task pointer to set. | ||
3592 | * | ||
3593 | * Description: This function must only be used when non-maskable interrupts | ||
3594 | * are serviced on a separate stack. It allows the architecture to switch the | ||
3595 | * notion of the current task on a cpu in a non-blocking manner. This function | ||
3596 | * must be called with interrupts disabled, the caller must save the original | ||
3597 | * value of the current task (see curr_task() above) and restore that value | ||
3598 | * before reenabling interrupts. | ||
3599 | */ | ||
3600 | void set_curr_task(int cpu, task_t *p) | ||
3601 | { | ||
3602 | cpu_curr(cpu) = p; | ||
3603 | } | ||
3604 | |||
3605 | /** | ||
3580 | * find_process_by_pid - find a process with a matching PID value. | 3606 | * find_process_by_pid - find a process with a matching PID value. |
3581 | * @pid: the pid in question. | 3607 | * @pid: the pid in question. |
3582 | */ | 3608 | */ |