diff options
author | Nick Piggin <nickpiggin@yahoo.com.au> | 2005-06-25 17:57:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-25 19:24:43 -0400 |
commit | 4866cde064afbb6c2a488c265e696879de616daa (patch) | |
tree | 6effad1ab6271129fc607b98273086409876563a /include/linux/sched.h | |
parent | 48c08d3f8ff94fa118187e4d8d4a5707bb85e59d (diff) |
[PATCH] sched: cleanup context switch locking
Instead of requiring architecture code to interact with the scheduler's
locking implementation, provide a couple of defines that can be used by the
architecture to request runqueue unlocked context switches, and ask for
interrupts to be enabled over the context switch.
Also replaces the "switch_lock" used by these architectures with an oncpu
flag (note, not a potentially slow bitflag). This eliminates one bus
locked memory operation when context switching, and simplifies the
task_running function.
Signed-off-by: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 36a10781c3f3..d27be9337425 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -368,6 +368,11 @@ struct signal_struct { | |||
368 | #endif | 368 | #endif |
369 | }; | 369 | }; |
370 | 370 | ||
371 | /* Context switch must be unlocked if interrupts are to be enabled */ | ||
372 | #ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW | ||
373 | # define __ARCH_WANT_UNLOCKED_CTXSW | ||
374 | #endif | ||
375 | |||
371 | /* | 376 | /* |
372 | * Bits in flags field of signal_struct. | 377 | * Bits in flags field of signal_struct. |
373 | */ | 378 | */ |
@@ -594,6 +599,9 @@ struct task_struct { | |||
594 | 599 | ||
595 | int lock_depth; /* BKL lock depth */ | 600 | int lock_depth; /* BKL lock depth */ |
596 | 601 | ||
602 | #if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) | ||
603 | int oncpu; | ||
604 | #endif | ||
597 | int prio, static_prio; | 605 | int prio, static_prio; |
598 | struct list_head run_list; | 606 | struct list_head run_list; |
599 | prio_array_t *array; | 607 | prio_array_t *array; |
@@ -716,8 +724,6 @@ struct task_struct { | |||
716 | spinlock_t alloc_lock; | 724 | spinlock_t alloc_lock; |
717 | /* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */ | 725 | /* Protection of proc_dentry: nesting proc_lock, dcache_lock, write_lock_irq(&tasklist_lock); */ |
718 | spinlock_t proc_lock; | 726 | spinlock_t proc_lock; |
719 | /* context-switch lock */ | ||
720 | spinlock_t switch_lock; | ||
721 | 727 | ||
722 | /* journalling filesystem info */ | 728 | /* journalling filesystem info */ |
723 | void *journal_info; | 729 | void *journal_info; |