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

Konstantin Khorenko khorenko at virtuozzo.com
Mon Nov 25 17:14:24 MSK 2024


The commit is pushed to "branch-rh9-5.14.0-427.33.1.vz9.102.x-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh9-5.14.0-427.33.1.vz9.102.2
------>
commit 731b333170e7dcd3003329087ee1843f38fe098d
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>
    
    https://virtuozzo.atlassian.net/browse/PSBM-159730
    Fixes: ff5626aa7856 ("sched: Port CONFIG_CFS_CPULIMIT feature")
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
    
    Feature: sched: ability to limit number of CPUs available to a CT
---
 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 0767e1ad165c..ee1844351230 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -11384,9 +11384,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