[Devel] [PATCH RHEL7 COMMIT] sched/fair: only update current task boost

Vladimir Davydov vdavydov at odin.com
Mon Sep 7 03:15:46 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.6.7
------>
commit e0e09e8e04e11319568ed71e13214a7d4e5810c7
Author: Vladimir Davydov <vdavydov at parallels.com>
Date:   Mon Sep 7 14:15:46 2015 +0400

    sched/fair: only update current task boost
    
    put_prev_task, which calls update_entity_boost, may be invoked for prev
    != current (e.g. on setprio). In rare cases (e.g. cpu offline), this is
    done before dequeue_task. As a result, a task might not get removed from
    the list of boosted entity on dequeue, leading to a crash.
    
    Anyway, it only makes sense to call update_entity_boost on current task,
    because it relies on preempt_count and flips task_struct bit fields. So
    insert the appropriate check to this function in order to fix this
    issue.
    
    Reported-by: Kirill Tkhai <ktkhai at odin.com>
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
    Acked-by: Kirill Tkhai <ktkhai at odin.com>
---
 kernel/sched/fair.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 3092f763f767..171601d766f8 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -960,6 +960,9 @@ static inline void update_entity_boost(struct sched_entity *se)
 	else {
 		struct task_struct *p = task_of(se);
 
+		if (unlikely(p != current))
+			return;
+
 		if (!(preempt_count() & PREEMPT_ACTIVE)) {
 			se->boosted = sched_feat(BOOST_WAKEUPS) &&
 					p->woken_while_running;



More information about the Devel mailing list