[RHEL8,COMMIT] kernel/sched/fair.c: Add more missing update_rq_clock() calls

Submitted by Konstantin Khorenko on Sept. 30, 2020, 2:08 p.m.

Details

Message ID 202009301408.08UE8PTK067086@finist-co8.sw.ru
State New
Series "kernel/sched/fair.c: Add missing update_rq_clock() calls"
Headers show

Commit Message

Konstantin Khorenko Sept. 30, 2020, 2:08 p.m.
The commit is pushed to "branch-rh8-4.18.0-193.6.3.vz8.4.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-193.6.3.vz8.4.9
------>
commit 76eb581be685154c58e1220adb3d08f4dff5bc8d
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Wed Sep 30 17:08:25 2020 +0300

    kernel/sched/fair.c: Add more missing update_rq_clock() calls
    
    Add update_rq_clock() for 'target_rq' to avoid WARN() coming
    from attach_task(). Also add rq_repin_lock(busiest, &rf); in
    load_balance() for detach_task(). The update_rq_clock() isn't
    necessary since it was updated before, but we need the repin
    since rq lock was released after update.
    
    https://jira.sw.ru/browse/PSBM-108013
    
    Reported-by: Kirill Tkhai <ktkhai@virtuozzo.com>
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Acked-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 kernel/sched/fair.c | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index e6dc21d5fa03..fc87dee4fd0e 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7817,6 +7817,7 @@  static int cpulimit_balance_cpu_stop(void *data)
 		schedstat_inc(sd->clb_count);
 
 		update_rq_clock(rq);
+		update_rq_clock(target_rq);
 		if (do_cpulimit_balance(&env))
 			schedstat_inc(sd->clb_pushed);
 		else
@@ -9177,6 +9178,7 @@  static int load_balance(int this_cpu, struct rq *this_rq,
 			env.loop = 0;
 			local_irq_save(rf.flags);
 			double_rq_lock(env.dst_rq, busiest);
+			rq_repin_lock(env.src_rq, &rf);
 			update_rq_clock(env.dst_rq);
 			cur_ld_moved = ld_moved = move_task_groups(&env);
 			double_rq_unlock(env.dst_rq, busiest);