[Devel] [PATCH RHEL7 COMMIT] ve/sched/core: Set task_struct::woken_while_running under rq lock

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jan 18 05:56:49 PST 2016


The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.9.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.9.23
------>
commit 87e3a24706b7f8c04da98a132be647b3a7a5e483
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Mon Jan 18 17:56:49 2016 +0400

    ve/sched/core: Set task_struct::woken_while_running under rq lock
    
    Since it's set under pi_lock and cleared under rq->lock, these
    both are not synchronized.
    
    Put move "woken_while_running = 1" in ttwu_remote(), where rq lock
    is held.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    Reviewed-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
 kernel/sched/core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index c8ac8bd..f61a4d1 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1616,6 +1616,7 @@ static int ttwu_remote(struct task_struct *p, int wake_flags)
 	rq = __task_rq_lock(p);
 	if (p->on_rq) {
 		ttwu_do_wakeup(rq, p, wake_flags);
+		p->woken_while_running = 1;
 		ret = 1;
 	}
 	__task_rq_unlock(rq);
@@ -1739,10 +1740,8 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
 	success = 1; /* we're going to change ->state */
 	cpu = task_cpu(p);
 
-	if (p->on_rq && ttwu_remote(p, wake_flags)) {
-		p->woken_while_running = 1;
+	if (p->on_rq && ttwu_remote(p, wake_flags))
 		goto stat;
-	}
 
 #ifdef CONFIG_SMP
 	/*


More information about the Devel mailing list