@@ -82,31 +82,29 @@ static void cpu_stop_signal_done(struct cpu_stop_done *done)
8282}
8383
8484static void __cpu_stop_queue_work (struct cpu_stopper * stopper ,
85- struct cpu_stop_work * work ,
86- struct wake_q_head * wakeq )
85+ struct cpu_stop_work * work )
8786{
8887 list_add_tail (& work -> list , & stopper -> works );
89- wake_q_add (wakeq , stopper -> thread );
9088}
9189
9290/* queue @work to @stopper. if offline, @work is completed immediately */
9391static bool cpu_stop_queue_work (unsigned int cpu , struct cpu_stop_work * work )
9492{
9593 struct cpu_stopper * stopper = & per_cpu (cpu_stopper , cpu );
96- DEFINE_WAKE_Q (wakeq );
9794 unsigned long flags ;
9895 bool enabled ;
9996
10097 preempt_disable ();
10198 raw_spin_lock_irqsave (& stopper -> lock , flags );
10299 enabled = stopper -> enabled ;
103100 if (enabled )
104- __cpu_stop_queue_work (stopper , work , & wakeq );
101+ __cpu_stop_queue_work (stopper , work );
105102 else if (work -> done )
106103 cpu_stop_signal_done (work -> done );
107104 raw_spin_unlock_irqrestore (& stopper -> lock , flags );
108105
109- wake_up_q (& wakeq );
106+ if (enabled )
107+ wake_up_process (stopper -> thread );
110108 preempt_enable ();
111109
112110 return enabled ;
@@ -263,7 +261,6 @@ static int cpu_stop_queue_two_works(int cpu1, struct cpu_stop_work *work1,
263261{
264262 struct cpu_stopper * stopper1 = per_cpu_ptr (& cpu_stopper , cpu1 );
265263 struct cpu_stopper * stopper2 = per_cpu_ptr (& cpu_stopper , cpu2 );
266- DEFINE_WAKE_Q (wakeq );
267264 int err ;
268265
269266retry :
@@ -299,8 +296,8 @@ static int cpu_stop_queue_two_works(int cpu1, struct cpu_stop_work *work1,
299296 }
300297
301298 err = 0 ;
302- __cpu_stop_queue_work (stopper1 , work1 , & wakeq );
303- __cpu_stop_queue_work (stopper2 , work2 , & wakeq );
299+ __cpu_stop_queue_work (stopper1 , work1 );
300+ __cpu_stop_queue_work (stopper2 , work2 );
304301
305302unlock :
306303 raw_spin_unlock (& stopper2 -> lock );
@@ -315,7 +312,10 @@ static int cpu_stop_queue_two_works(int cpu1, struct cpu_stop_work *work1,
315312 goto retry ;
316313 }
317314
318- wake_up_q (& wakeq );
315+ if (!err ) {
316+ wake_up_process (stopper1 -> thread );
317+ wake_up_process (stopper2 -> thread );
318+ }
319319 preempt_enable ();
320320
321321 return err ;
0 commit comments