[Devel] [PATCH RHEL COMMIT] kernel/sched/fair: Fix 'releasing a pinned lock'

Konstantin Khorenko khorenko at virtuozzo.com
Fri Oct 1 19:38:39 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after ark-5.14
------>
commit d7f3dee450a4ac83abe2bae4eefaef8361320394
Author: Andrey Ryabinin <ryabinin.a.a at gmail.com>
Date:   Fri Oct 1 19:38:39 2021 +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 at virtuozzo.com>
    
    Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    (cherry-picked from vz8 commit 9c9976ed56ec ("kernel/sched/fair: Fix
    'releasing a pinned lock'"))
    
    Signed-off-by: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
---
 kernel/sched/fair.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index e5b9d9d26e78..556bd109049a 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -10199,9 +10199,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);
                 }


More information about the Devel mailing list