[Devel] [PATCH vz9 08/23] kernel/sched/fair: Fix 'releasing a pinned lock'

Nikita Yushchenko nikita.yushchenko at virtuozzo.com
Fri Oct 1 18:53:16 MSK 2021


From: Andrey Ryabinin <aryabinin at virtuozzo.com>

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);
                 }
-- 
2.30.2



More information about the Devel mailing list