@ -2217,16 +2217,17 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags,
* current .
*/
smp_rmb ( ) ;
if ( READ_ONCE ( p - > on_rq ) & & ttwu_remote ( p , wake_flags ) )
if ( READ_ONCE ( p - > on_rq ) ) {
if ( ttwu_remote ( p , wake_flags ) )
goto unlock ;
} else {
# ifdef CONFIG_SMP
/*
* Ensure we load p - > on_cpu _after_ p - > on_rq , otherwise it would be
* possible to , falsely , observe p - > on_cpu = = 0.
* Ensure we load p - > on_cpu _after_ p - > on_rq , otherwise it would
* be possible to , falsely , observe p - > on_cpu = = 0.
*
* One must be running ( - > on_cpu = = 1 ) in order to remove oneself
* from the runqueue .
* One must be running ( - > on_cpu = = 1 ) in order to remove
* oneself from the runqueue .
*
* [ S ] - > on_cpu = 1 ; [ L ] - > on_rq
* UNLOCK rq - > lock
@ -2234,16 +2235,20 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags,
* LOCK rq - > lock
* [ S ] - > on_rq = 0 ; [ L ] - > on_cpu
*
* Pairs with the full barrier implied in the UNLOCK + LOCK on rq - > lock
* from the consecutive calls to schedule ( ) ; the first switching to our
* task , the second putting it to sleep .
* Pairs with the full barrier implied in the UNLOCK + LOCK on
* rq - > lock from the consecutive calls to schedule ( ) ; the first
* switching to our task , the second putting it to sleep .
*
* Form a control - dep - acquire with p - > on_rq = = 0 above , to ensure
* schedule ( ) ' s deactivate_task ( ) has ' happened ' and p will no longer
* care about it ' s own p - > state . See the comment in __schedule ( ) .
* Form a control - dep - acquire with p - > on_rq = = 0 above , to
* ensure schedule ( ) ' s deactivate_task ( ) has ' happened ' and p
* will no longer care about it ' s own p - > state . See the comment
* in __schedule ( ) .
*/
smp_acquire__after_ctrl_dep ( ) ;
# endif
}
# ifdef CONFIG_SMP
/*
* We ' re doing the wakeup ( @ success = = 1 ) , they did a dequeue ( p - > on_rq
* = = 0 ) , which means we need to do an enqueue , change p - > state to