diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2011-03-12 05:37:14 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2011-03-12 05:43:32 -0500 |
commit | 995612178c88407d8330f580ba6572cb8b284dd8 (patch) | |
tree | ea19d21342814758a729ba931180146422393d15 /include | |
parent | 8d7718aa082aaf30a0b4989e1f04858952f941bc (diff) | |
parent | 6d55da53db3d9b911f69f2ce1e5fb8943eafe057 (diff) |
Merge branch 'tip/futex/devel' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-rt into core/futexes
futex,plist: Pass the real head of the priority list to plist_del()
futex,plist: Remove debug lock assignment from plist_node
plist: Shrink struct plist_head
plist: Add priority list test
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/plist.h | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/include/linux/plist.h b/include/linux/plist.h index 7254eda078e5..c9b9f322c8d8 100644 --- a/include/linux/plist.h +++ b/include/linux/plist.h | |||
@@ -31,15 +31,17 @@ | |||
31 | * | 31 | * |
32 | * Simple ASCII art explanation: | 32 | * Simple ASCII art explanation: |
33 | * | 33 | * |
34 | * |HEAD | | 34 | * pl:prio_list (only for plist_node) |
35 | * | | | 35 | * nl:node_list |
36 | * |prio_list.prev|<------------------------------------| | 36 | * HEAD| NODE(S) |
37 | * |prio_list.next|<->|pl|<->|pl|<--------------->|pl|<-| | 37 | * | |
38 | * |10 | |10| |21| |21| |21| |40| (prio) | 38 | * ||------------------------------------| |
39 | * | | | | | | | | | | | | | 39 | * ||->|pl|<->|pl|<--------------->|pl|<-| |
40 | * | | | | | | | | | | | | | 40 | * | |10| |21| |21| |21| |40| (prio) |
41 | * |node_list.next|<->|nl|<->|nl|<->|nl|<->|nl|<->|nl|<-| | 41 | * | | | | | | | | | | | |
42 | * |node_list.prev|<------------------------------------| | 42 | * | | | | | | | | | | | |
43 | * |->|nl|<->|nl|<->|nl|<->|nl|<->|nl|<->|nl|<-| | ||
44 | * |-------------------------------------------| | ||
43 | * | 45 | * |
44 | * The nodes on the prio_list list are sorted by priority to simplify | 46 | * The nodes on the prio_list list are sorted by priority to simplify |
45 | * the insertion of new nodes. There are no nodes with duplicate | 47 | * the insertion of new nodes. There are no nodes with duplicate |
@@ -78,7 +80,6 @@ | |||
78 | #include <linux/spinlock_types.h> | 80 | #include <linux/spinlock_types.h> |
79 | 81 | ||
80 | struct plist_head { | 82 | struct plist_head { |
81 | struct list_head prio_list; | ||
82 | struct list_head node_list; | 83 | struct list_head node_list; |
83 | #ifdef CONFIG_DEBUG_PI_LIST | 84 | #ifdef CONFIG_DEBUG_PI_LIST |
84 | raw_spinlock_t *rawlock; | 85 | raw_spinlock_t *rawlock; |
@@ -88,7 +89,8 @@ struct plist_head { | |||
88 | 89 | ||
89 | struct plist_node { | 90 | struct plist_node { |
90 | int prio; | 91 | int prio; |
91 | struct plist_head plist; | 92 | struct list_head prio_list; |
93 | struct list_head node_list; | ||
92 | }; | 94 | }; |
93 | 95 | ||
94 | #ifdef CONFIG_DEBUG_PI_LIST | 96 | #ifdef CONFIG_DEBUG_PI_LIST |
@@ -100,7 +102,6 @@ struct plist_node { | |||
100 | #endif | 102 | #endif |
101 | 103 | ||
102 | #define _PLIST_HEAD_INIT(head) \ | 104 | #define _PLIST_HEAD_INIT(head) \ |
103 | .prio_list = LIST_HEAD_INIT((head).prio_list), \ | ||
104 | .node_list = LIST_HEAD_INIT((head).node_list) | 105 | .node_list = LIST_HEAD_INIT((head).node_list) |
105 | 106 | ||
106 | /** | 107 | /** |
@@ -133,7 +134,8 @@ struct plist_node { | |||
133 | #define PLIST_NODE_INIT(node, __prio) \ | 134 | #define PLIST_NODE_INIT(node, __prio) \ |
134 | { \ | 135 | { \ |
135 | .prio = (__prio), \ | 136 | .prio = (__prio), \ |
136 | .plist = { _PLIST_HEAD_INIT((node).plist) }, \ | 137 | .prio_list = LIST_HEAD_INIT((node).prio_list), \ |
138 | .node_list = LIST_HEAD_INIT((node).node_list), \ | ||
137 | } | 139 | } |
138 | 140 | ||
139 | /** | 141 | /** |
@@ -144,7 +146,6 @@ struct plist_node { | |||
144 | static inline void | 146 | static inline void |
145 | plist_head_init(struct plist_head *head, spinlock_t *lock) | 147 | plist_head_init(struct plist_head *head, spinlock_t *lock) |
146 | { | 148 | { |
147 | INIT_LIST_HEAD(&head->prio_list); | ||
148 | INIT_LIST_HEAD(&head->node_list); | 149 | INIT_LIST_HEAD(&head->node_list); |
149 | #ifdef CONFIG_DEBUG_PI_LIST | 150 | #ifdef CONFIG_DEBUG_PI_LIST |
150 | head->spinlock = lock; | 151 | head->spinlock = lock; |
@@ -160,7 +161,6 @@ plist_head_init(struct plist_head *head, spinlock_t *lock) | |||
160 | static inline void | 161 | static inline void |
161 | plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock) | 162 | plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock) |
162 | { | 163 | { |
163 | INIT_LIST_HEAD(&head->prio_list); | ||
164 | INIT_LIST_HEAD(&head->node_list); | 164 | INIT_LIST_HEAD(&head->node_list); |
165 | #ifdef CONFIG_DEBUG_PI_LIST | 165 | #ifdef CONFIG_DEBUG_PI_LIST |
166 | head->rawlock = lock; | 166 | head->rawlock = lock; |
@@ -176,7 +176,8 @@ plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock) | |||
176 | static inline void plist_node_init(struct plist_node *node, int prio) | 176 | static inline void plist_node_init(struct plist_node *node, int prio) |
177 | { | 177 | { |
178 | node->prio = prio; | 178 | node->prio = prio; |
179 | plist_head_init(&node->plist, NULL); | 179 | INIT_LIST_HEAD(&node->prio_list); |
180 | INIT_LIST_HEAD(&node->node_list); | ||
180 | } | 181 | } |
181 | 182 | ||
182 | extern void plist_add(struct plist_node *node, struct plist_head *head); | 183 | extern void plist_add(struct plist_node *node, struct plist_head *head); |
@@ -188,7 +189,7 @@ extern void plist_del(struct plist_node *node, struct plist_head *head); | |||
188 | * @head: the head for your list | 189 | * @head: the head for your list |
189 | */ | 190 | */ |
190 | #define plist_for_each(pos, head) \ | 191 | #define plist_for_each(pos, head) \ |
191 | list_for_each_entry(pos, &(head)->node_list, plist.node_list) | 192 | list_for_each_entry(pos, &(head)->node_list, node_list) |
192 | 193 | ||
193 | /** | 194 | /** |
194 | * plist_for_each_safe - iterate safely over a plist of given type | 195 | * plist_for_each_safe - iterate safely over a plist of given type |
@@ -199,7 +200,7 @@ extern void plist_del(struct plist_node *node, struct plist_head *head); | |||
199 | * Iterate over a plist of given type, safe against removal of list entry. | 200 | * Iterate over a plist of given type, safe against removal of list entry. |
200 | */ | 201 | */ |
201 | #define plist_for_each_safe(pos, n, head) \ | 202 | #define plist_for_each_safe(pos, n, head) \ |
202 | list_for_each_entry_safe(pos, n, &(head)->node_list, plist.node_list) | 203 | list_for_each_entry_safe(pos, n, &(head)->node_list, node_list) |
203 | 204 | ||
204 | /** | 205 | /** |
205 | * plist_for_each_entry - iterate over list of given type | 206 | * plist_for_each_entry - iterate over list of given type |
@@ -208,7 +209,7 @@ extern void plist_del(struct plist_node *node, struct plist_head *head); | |||
208 | * @mem: the name of the list_struct within the struct | 209 | * @mem: the name of the list_struct within the struct |
209 | */ | 210 | */ |
210 | #define plist_for_each_entry(pos, head, mem) \ | 211 | #define plist_for_each_entry(pos, head, mem) \ |
211 | list_for_each_entry(pos, &(head)->node_list, mem.plist.node_list) | 212 | list_for_each_entry(pos, &(head)->node_list, mem.node_list) |
212 | 213 | ||
213 | /** | 214 | /** |
214 | * plist_for_each_entry_safe - iterate safely over list of given type | 215 | * plist_for_each_entry_safe - iterate safely over list of given type |
@@ -220,7 +221,7 @@ extern void plist_del(struct plist_node *node, struct plist_head *head); | |||
220 | * Iterate over list of given type, safe against removal of list entry. | 221 | * Iterate over list of given type, safe against removal of list entry. |
221 | */ | 222 | */ |
222 | #define plist_for_each_entry_safe(pos, n, head, m) \ | 223 | #define plist_for_each_entry_safe(pos, n, head, m) \ |
223 | list_for_each_entry_safe(pos, n, &(head)->node_list, m.plist.node_list) | 224 | list_for_each_entry_safe(pos, n, &(head)->node_list, m.node_list) |
224 | 225 | ||
225 | /** | 226 | /** |
226 | * plist_head_empty - return !0 if a plist_head is empty | 227 | * plist_head_empty - return !0 if a plist_head is empty |
@@ -237,7 +238,7 @@ static inline int plist_head_empty(const struct plist_head *head) | |||
237 | */ | 238 | */ |
238 | static inline int plist_node_empty(const struct plist_node *node) | 239 | static inline int plist_node_empty(const struct plist_node *node) |
239 | { | 240 | { |
240 | return plist_head_empty(&node->plist); | 241 | return list_empty(&node->node_list); |
241 | } | 242 | } |
242 | 243 | ||
243 | /* All functions below assume the plist_head is not empty. */ | 244 | /* All functions below assume the plist_head is not empty. */ |
@@ -285,7 +286,7 @@ static inline int plist_node_empty(const struct plist_node *node) | |||
285 | static inline struct plist_node *plist_first(const struct plist_head *head) | 286 | static inline struct plist_node *plist_first(const struct plist_head *head) |
286 | { | 287 | { |
287 | return list_entry(head->node_list.next, | 288 | return list_entry(head->node_list.next, |
288 | struct plist_node, plist.node_list); | 289 | struct plist_node, node_list); |
289 | } | 290 | } |
290 | 291 | ||
291 | /** | 292 | /** |
@@ -297,7 +298,7 @@ static inline struct plist_node *plist_first(const struct plist_head *head) | |||
297 | static inline struct plist_node *plist_last(const struct plist_head *head) | 298 | static inline struct plist_node *plist_last(const struct plist_head *head) |
298 | { | 299 | { |
299 | return list_entry(head->node_list.prev, | 300 | return list_entry(head->node_list.prev, |
300 | struct plist_node, plist.node_list); | 301 | struct plist_node, node_list); |
301 | } | 302 | } |
302 | 303 | ||
303 | #endif | 304 | #endif |