Skip to content

Commit 49041e8

Browse files
author
Peter Zijlstra
committed
sched: Fold rq-pin swizzle into __balance_callbacks()
Prepare for more users needing the rq-pin swizzle. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Tested-by: Pierre Gondois <pierre.gondois@arm.com> Tested-by: Juri Lelli <juri.lelli@redhat.com> Link: https://patch.msgid.link/20260114130528.GB831285@noisy.programming.kicks-ass.net
1 parent 4de9ff7 commit 49041e8

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

kernel/sched/core.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4950,9 +4950,13 @@ struct balance_callback *splice_balance_callbacks(struct rq *rq)
49504950
return __splice_balance_callbacks(rq, true);
49514951
}
49524952

4953-
static void __balance_callbacks(struct rq *rq)
4953+
static void __balance_callbacks(struct rq *rq, struct rq_flags *rf)
49544954
{
4955+
if (rf)
4956+
rq_unpin_lock(rq, rf);
49554957
do_balance_callbacks(rq, __splice_balance_callbacks(rq, false));
4958+
if (rf)
4959+
rq_repin_lock(rq, rf);
49564960
}
49574961

49584962
void balance_callbacks(struct rq *rq, struct balance_callback *head)
@@ -4991,7 +4995,7 @@ static inline void finish_lock_switch(struct rq *rq)
49914995
* prev into current:
49924996
*/
49934997
spin_acquire(&__rq_lockp(rq)->dep_map, 0, 0, _THIS_IP_);
4994-
__balance_callbacks(rq);
4998+
__balance_callbacks(rq, NULL);
49954999
raw_spin_rq_unlock_irq(rq);
49965000
}
49975001

@@ -6867,7 +6871,7 @@ static void __sched notrace __schedule(int sched_mode)
68676871
proxy_tag_curr(rq, next);
68686872

68696873
rq_unpin_lock(rq, &rf);
6870-
__balance_callbacks(rq);
6874+
__balance_callbacks(rq, NULL);
68716875
raw_spin_rq_unlock_irq(rq);
68726876
}
68736877
trace_sched_exit_tp(is_switch);
@@ -7362,9 +7366,7 @@ void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task)
73627366
out_unlock:
73637367
/* Caller holds task_struct::pi_lock, IRQs are still disabled */
73647368

7365-
rq_unpin_lock(rq, &rf);
7366-
__balance_callbacks(rq);
7367-
rq_repin_lock(rq, &rf);
7369+
__balance_callbacks(rq, &rf);
73687370
__task_rq_unlock(rq, p, &rf);
73697371
}
73707372
#endif /* CONFIG_RT_MUTEXES */

0 commit comments

Comments
 (0)