@@ -121,11 +121,12 @@ static int __wake_up_common(struct wait_queue_head *wq_head, unsigned int mode,
121
121
return nr_exclusive ;
122
122
}
123
123
124
- static void __wake_up_common_lock (struct wait_queue_head * wq_head , unsigned int mode ,
124
+ static int __wake_up_common_lock (struct wait_queue_head * wq_head , unsigned int mode ,
125
125
int nr_exclusive , int wake_flags , void * key )
126
126
{
127
127
unsigned long flags ;
128
128
wait_queue_entry_t bookmark ;
129
+ int remaining = nr_exclusive ;
129
130
130
131
bookmark .flags = 0 ;
131
132
bookmark .private = NULL ;
@@ -134,10 +135,12 @@ static void __wake_up_common_lock(struct wait_queue_head *wq_head, unsigned int
134
135
135
136
do {
136
137
spin_lock_irqsave (& wq_head -> lock , flags );
137
- nr_exclusive = __wake_up_common (wq_head , mode , nr_exclusive ,
138
+ remaining = __wake_up_common (wq_head , mode , remaining ,
138
139
wake_flags , key , & bookmark );
139
140
spin_unlock_irqrestore (& wq_head -> lock , flags );
140
141
} while (bookmark .flags & WQ_FLAG_BOOKMARK );
142
+
143
+ return nr_exclusive - remaining ;
141
144
}
142
145
143
146
/**
@@ -147,13 +150,14 @@ static void __wake_up_common_lock(struct wait_queue_head *wq_head, unsigned int
147
150
* @nr_exclusive: how many wake-one or wake-many threads to wake up
148
151
* @key: is directly passed to the wakeup function
149
152
*
150
- * If this function wakes up a task, it executes a full memory barrier before
151
- * accessing the task state.
153
+ * If this function wakes up a task, it executes a full memory barrier
154
+ * before accessing the task state. Returns the number of exclusive
155
+ * tasks that were awaken.
152
156
*/
153
- void __wake_up (struct wait_queue_head * wq_head , unsigned int mode ,
154
- int nr_exclusive , void * key )
157
+ int __wake_up (struct wait_queue_head * wq_head , unsigned int mode ,
158
+ int nr_exclusive , void * key )
155
159
{
156
- __wake_up_common_lock (wq_head , mode , nr_exclusive , 0 , key );
160
+ return __wake_up_common_lock (wq_head , mode , nr_exclusive , 0 , key );
157
161
}
158
162
EXPORT_SYMBOL (__wake_up );
159
163
0 commit comments