@@ -121,11 +121,12 @@ static int __wake_up_common(struct wait_queue_head *wq_head, unsigned int mode,
121121	return  nr_exclusive ;
122122}
123123
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 ,
125125			int  nr_exclusive , int  wake_flags , void  * key )
126126{
127127	unsigned long  flags ;
128128	wait_queue_entry_t  bookmark ;
129+ 	int  remaining  =  nr_exclusive ;
129130
130131	bookmark .flags  =  0 ;
131132	bookmark .private  =  NULL ;
@@ -134,10 +135,12 @@ static void __wake_up_common_lock(struct wait_queue_head *wq_head, unsigned int
134135
135136	do  {
136137		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 ,
138139						wake_flags , key , & bookmark );
139140		spin_unlock_irqrestore (& wq_head -> lock , flags );
140141	} while  (bookmark .flags  &  WQ_FLAG_BOOKMARK );
142+ 
143+ 	return  nr_exclusive  -  remaining ;
141144}
142145
143146/** 
@@ -147,13 +150,14 @@ static void __wake_up_common_lock(struct wait_queue_head *wq_head, unsigned int
147150 * @nr_exclusive: how many wake-one or wake-many threads to wake up 
148151 * @key: is directly passed to the wakeup function 
149152 * 
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. 
152156 */ 
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 )
155159{
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 );
157161}
158162EXPORT_SYMBOL (__wake_up );
159163
0 commit comments