diff options
| author | Ingo Molnar <mingo@elte.hu> | 2002-07-23 22:17:36 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@penguin.transmeta.com> | 2002-07-23 22:17:36 -0700 |
| commit | 97db62cc99a0d92650fbf23b7fbc034107eb01f3 (patch) | |
| tree | a708e1efa64cb8020b108b949857358e0a1cf19b /include | |
| parent | 9e7cec8858f964d3be10e2f703c841cf05871e09 (diff) | |
[PATCH] scheduler fixes
- introduce new type of context-switch locking, this is a must-have for
ia64 and sparc64.
- load_balance() bug noticed by Scott Rhine and myself: scan the
whole list to find imbalance number of tasks, not just the tail
of the list.
- sched_yield() fix: use current->array not rq->active.
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-i386/system.h | 5 | ||||
| -rw-r--r-- | include/asm-ppc/system.h | 5 | ||||
| -rw-r--r-- | include/asm-s390/system.h | 5 | ||||
| -rw-r--r-- | include/asm-s390x/system.h | 5 | ||||
| -rw-r--r-- | include/asm-sparc64/system.h | 16 | ||||
| -rw-r--r-- | include/asm-x86_64/system.h | 5 | ||||
| -rw-r--r-- | include/linux/init_task.h | 3 | ||||
| -rw-r--r-- | include/linux/sched.h | 8 |
8 files changed, 17 insertions, 35 deletions
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h index b5bfa022bde7..d6b04c0fed09 100644 --- a/include/asm-i386/system.h +++ b/include/asm-i386/system.h @@ -11,11 +11,6 @@ struct task_struct; /* one of the stranger aspects of C forward declarations.. */ extern void FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next)); -#define prepare_arch_schedule(prev) do { } while(0) -#define finish_arch_schedule(prev) do { } while(0) -#define prepare_arch_switch(rq) do { } while(0) -#define finish_arch_switch(rq) spin_unlock_irq(&(rq)->lock) - #define switch_to(prev,next,last) do { \ asm volatile("pushl %%esi\n\t" \ "pushl %%edi\n\t" \ diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h index a9a6b1ac6aab..00fafc7226c1 100644 --- a/include/asm-ppc/system.h +++ b/include/asm-ppc/system.h @@ -83,11 +83,6 @@ extern void cacheable_memzero(void *p, unsigned int nb); struct device_node; extern void note_scsi_host(struct device_node *, void *); -#define prepare_arch_schedule(prev) do { } while(0) -#define finish_arch_schedule(prev) do { } while(0) -#define prepare_arch_switch(rq) do { } while(0) -#define finish_arch_switch(rq) spin_unlock_irq(&(rq)->lock) - struct task_struct; extern void __switch_to(struct task_struct *, struct task_struct *); #define switch_to(prev, next, last) __switch_to((prev), (next)) diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h index ab7e6a28196f..15e1af97a358 100644 --- a/include/asm-s390/system.h +++ b/include/asm-s390/system.h @@ -18,11 +18,6 @@ #endif #include <linux/kernel.h> -#define prepare_arch_schedule(prev) do { } while (0) -#define finish_arch_schedule(prev) do { } while (0) -#define prepare_arch_switch(rq) do { } while (0) -#define finish_arch_switch(rq) spin_unlock_irq(&(rq)->lock) - #define switch_to(prev,next,last) do { \ if (prev == next) \ break; \ diff --git a/include/asm-s390x/system.h b/include/asm-s390x/system.h index 2454658db855..81810a4819b9 100644 --- a/include/asm-s390x/system.h +++ b/include/asm-s390x/system.h @@ -18,11 +18,6 @@ #endif #include <linux/kernel.h> -#define prepare_arch_schedule(prev) do { } while (0) -#define finish_arch_schedule(prev) do { } while (0) -#define prepare_arch_switch(rq) do { } while (0) -#define finish_arch_switch(rq) spin_unlock_irq(&(rq)->lock) - #define switch_to(prev,next),last do { \ if (prev == next) \ break; \ diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h index f98e5915e612..4f8af64d6572 100644 --- a/include/asm-sparc64/system.h +++ b/include/asm-sparc64/system.h @@ -140,13 +140,17 @@ extern void __flushw_user(void); #define flush_user_windows flushw_user #define flush_register_windows flushw_all -#define prepare_arch_schedule(prev) task_lock(prev) -#define finish_arch_schedule(prev) task_unlock(prev) -#define prepare_arch_switch(rq) \ -do { spin_unlock(&(rq)->lock); \ - flushw_all(); \ +#define prepare_arch_switch(rq, next) \ +do { spin_lock(&(next)->switch_lock); \ + spin_unlock(&(rq)->lock); \ + flushw_all(); \ } while (0) -#define finish_arch_switch(rq) local_irq_enable() + +#define finish_arch_switch(rq, prev) \ +do { spin_unlock_irq(&(prev)->switch_lock); \ +} while (0) + + #ifndef CONFIG_DEBUG_SPINLOCK #define CHECK_LOCKS(PREV) do { } while(0) diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h index c9604630f910..c0c88ba72c97 100644 --- a/include/asm-x86_64/system.h +++ b/include/asm-x86_64/system.h @@ -13,11 +13,6 @@ #define LOCK_PREFIX "" #endif -#define prepare_arch_schedule(prev) do { } while(0) -#define finish_arch_schedule(prev) do { } while(0) -#define prepare_arch_switch(rq) do { } while(0) -#define finish_arch_switch(rq) spin_unlock_irq(&(rq)->lock) - #define __STR(x) #x #define STR(x) __STR(x) diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 4fcbad0862b8..56c6b7181796 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h @@ -47,7 +47,7 @@ lock_depth: -1, \ prio: MAX_PRIO-20, \ static_prio: MAX_PRIO-20, \ - policy: SCHED_OTHER, \ + policy: SCHED_NORMAL, \ cpus_allowed: -1, \ mm: NULL, \ active_mm: &init_mm, \ @@ -78,6 +78,7 @@ pending: { NULL, &tsk.pending.head, {{0}}}, \ blocked: {{0}}, \ alloc_lock: SPIN_LOCK_UNLOCKED, \ + switch_lock: SPIN_LOCK_UNLOCKED, \ journal_info: NULL, \ } diff --git a/include/linux/sched.h b/include/linux/sched.h index 004d2a129ca4..6dd4746e58cd 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -116,7 +116,7 @@ extern unsigned long nr_uninterruptible(void); /* * Scheduling policies */ -#define SCHED_OTHER 0 +#define SCHED_NORMAL 0 #define SCHED_FIFO 1 #define SCHED_RR 2 @@ -207,7 +207,7 @@ struct signal_struct { /* * Priority of a process goes from 0..MAX_PRIO-1, valid RT - * priority is 0..MAX_RT_PRIO-1, and SCHED_OTHER tasks are + * priority is 0..MAX_RT_PRIO-1, and SCHED_NORMAL tasks are * in the range MAX_RT_PRIO..MAX_PRIO-1. Priority values * are inverted: lower p->prio value means higher priority. * @@ -264,7 +264,7 @@ struct task_struct { unsigned long policy; unsigned long cpus_allowed; - unsigned int time_slice; + unsigned int time_slice, first_time_slice; struct list_head tasks; @@ -361,6 +361,8 @@ struct task_struct { u32 self_exec_id; /* Protection of (de-)allocation: mm, files, fs, tty */ spinlock_t alloc_lock; +/* context-switch lock */ + spinlock_t switch_lock; /* journalling filesystem info */ void *journal_info; |
