diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2011-08-27 09:43:54 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2011-08-27 10:06:11 -0400 |
commit | 7b1bb388bc879ffcc6c69b567816d5c354afe42b (patch) | |
tree | 5a217fdfb0b5e5a327bdcd624506337c1ae1fe32 /include/linux/rwsem.h | |
parent | 7d754596756240fa918b94cd0c3011c77a638987 (diff) | |
parent | 02f8c6aee8df3cdc935e9bdd4f2d020306035dbe (diff) |
Merge 'Linux v3.0' into Litmus
Some notes:
* Litmus^RT scheduling class is the topmost scheduling class
(above stop_sched_class).
* scheduler_ipi() function (e.g., in smp_reschedule_interrupt())
may increase IPI latencies.
* Added path into schedule() to quickly re-evaluate scheduling
decision without becoming preemptive again. This used to be
a standard path before the removal of BKL.
Conflicts:
Makefile
arch/arm/kernel/calls.S
arch/arm/kernel/smp.c
arch/x86/include/asm/unistd_32.h
arch/x86/kernel/smp.c
arch/x86/kernel/syscall_table_32.S
include/linux/hrtimer.h
kernel/printk.c
kernel/sched.c
kernel/sched_fair.c
Diffstat (limited to 'include/linux/rwsem.h')
-rw-r--r-- | include/linux/rwsem.h | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h index efd348fe8ca7..a8afe9cd000c 100644 --- a/include/linux/rwsem.h +++ b/include/linux/rwsem.h | |||
@@ -11,6 +11,9 @@ | |||
11 | 11 | ||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/list.h> | ||
15 | #include <linux/spinlock.h> | ||
16 | |||
14 | #include <asm/system.h> | 17 | #include <asm/system.h> |
15 | #include <asm/atomic.h> | 18 | #include <asm/atomic.h> |
16 | 19 | ||
@@ -19,9 +22,57 @@ struct rw_semaphore; | |||
19 | #ifdef CONFIG_RWSEM_GENERIC_SPINLOCK | 22 | #ifdef CONFIG_RWSEM_GENERIC_SPINLOCK |
20 | #include <linux/rwsem-spinlock.h> /* use a generic implementation */ | 23 | #include <linux/rwsem-spinlock.h> /* use a generic implementation */ |
21 | #else | 24 | #else |
22 | #include <asm/rwsem.h> /* use an arch-specific implementation */ | 25 | /* All arch specific implementations share the same struct */ |
26 | struct rw_semaphore { | ||
27 | long count; | ||
28 | spinlock_t wait_lock; | ||
29 | struct list_head wait_list; | ||
30 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
31 | struct lockdep_map dep_map; | ||
32 | #endif | ||
33 | }; | ||
34 | |||
35 | extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); | ||
36 | extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); | ||
37 | extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *); | ||
38 | extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); | ||
39 | |||
40 | /* Include the arch specific part */ | ||
41 | #include <asm/rwsem.h> | ||
42 | |||
43 | /* In all implementations count != 0 means locked */ | ||
44 | static inline int rwsem_is_locked(struct rw_semaphore *sem) | ||
45 | { | ||
46 | return sem->count != 0; | ||
47 | } | ||
48 | |||
49 | #endif | ||
50 | |||
51 | /* Common initializer macros and functions */ | ||
52 | |||
53 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
54 | # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } | ||
55 | #else | ||
56 | # define __RWSEM_DEP_MAP_INIT(lockname) | ||
23 | #endif | 57 | #endif |
24 | 58 | ||
59 | #define __RWSEM_INITIALIZER(name) \ | ||
60 | { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED(name.wait_lock), \ | ||
61 | LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) } | ||
62 | |||
63 | #define DECLARE_RWSEM(name) \ | ||
64 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) | ||
65 | |||
66 | extern void __init_rwsem(struct rw_semaphore *sem, const char *name, | ||
67 | struct lock_class_key *key); | ||
68 | |||
69 | #define init_rwsem(sem) \ | ||
70 | do { \ | ||
71 | static struct lock_class_key __key; \ | ||
72 | \ | ||
73 | __init_rwsem((sem), #sem, &__key); \ | ||
74 | } while (0) | ||
75 | |||
25 | /* | 76 | /* |
26 | * lock for reading | 77 | * lock for reading |
27 | */ | 78 | */ |