Re: [PATCH 3/6] sched_ext: Make @rf optional for dispatch_to_local_dsq()
From: Andrea Righi
Date: Wed Jul 10 2024 - 05:01:18 EST
On Tue, Jul 09, 2024 at 11:21:09AM -1000, Tejun Heo wrote:
...
> @@ -2052,17 +2052,20 @@ static bool move_task_to_local_dsq(struct rq *rq, struct task_struct *p,
> static void dispatch_to_local_dsq_lock(struct rq *rq, struct rq_flags *rf,
> struct rq *src_rq, struct rq *dst_rq)
> {
> - rq_unpin_lock(rq, rf);
> + if (rf)
> + rq_unpin_lock(rq, rf);
>
> if (src_rq == dst_rq) {
> raw_spin_rq_unlock(rq);
> raw_spin_rq_lock(dst_rq);
> } else if (rq == src_rq) {
> double_lock_balance(rq, dst_rq);
> - rq_repin_lock(rq, rf);
> + if (rf)
> + rq_repin_lock(rq, rf);
> } else if (rq == dst_rq) {
> double_lock_balance(rq, src_rq);
> - rq_repin_lock(rq, rf);
> + if (rf)
> + rq_repin_lock(rq, rf);
> } else {
> raw_spin_rq_unlock(rq);
> double_rq_lock(src_rq, dst_rq);
Not a blocker, but would it make sense to provide some wrappers for
rq_unpin_lock() / rq_repin_lock() to simply return if rf == NULL?
Maybe it can help to make the code a bit more readable.
-Andrea