[RHEL8,COMMIT] kernel/sched/fair: Fix 'releasing a pinned lock'

Submitted by Konstantin Khorenko on Oct. 8, 2020, 4 p.m.

Details

Message ID 202010081600.098G0NqC1173279@finist-co8.sw.ru
State New
Series "kernel/sched/fair: Fix 'releasing a pinned lock'"
Headers show

Commit Message

Konstantin Khorenko Oct. 8, 2020, 4 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.12
------>
commit a9f90d574027e70025b6401cc3dcb4135c645893
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Thu Oct 8 19:00:23 2020 +0300

    kernel/sched/fair: Fix 'releasing a pinned lock'
    
    Lockdep complains that after rq_repin_lock() the lock wasn't unpinned
    before rq->lock release.
    
    Add rq_unpin_lock(); call to fix this. Also for consistency use 'busiest'
    instead of 'env.src_rq' which is the same.
    
    https://jira.sw.ru/browse/PSBM-120800
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
    Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 kernel/sched/fair.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index fc87dee4fd0e..23a2f2452474 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9178,9 +9178,10 @@  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);
+			rq_repin_lock(busiest, &rf);
 			update_rq_clock(env.dst_rq);
 			cur_ld_moved = ld_moved = move_task_groups(&env);
+			rq_unpin_lock(busiest, &rf);
 			double_rq_unlock(env.dst_rq, busiest);
 			local_irq_restore(rf.flags);
                 }