Re: [RFC PATCH 07/11] sched: Add proxy execution
From: Dietmar Eggemann
Date: Mon Oct 31 2022 - 12:40:04 EST
On 29/10/2022 05:31, Joel Fernandes wrote:
> Hello Dietmar,
>
>> On Oct 24, 2022, at 6:13 AM, Dietmar Eggemann <dietmar.eggemann@xxxxxxx> wrote:
>>
>> On 03/10/2022 23:44, Connor O'Brien wrote:
>>> From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
[...]
>>> + put_prev_task(rq, next);
>>> + if (curr_in_chain) {
>>> + rq->proxy = rq->idle;
>>> + set_tsk_need_resched(rq->idle);
>>> + /*
>>> + * XXX [juril] don't we still need to migrate @next to
>>> + * @owner's CPU?
>>> + */
>>> + return rq->idle;
>>> + }
>>
>> --> (1)
>
> Sorry but what has this got to do with your comment below?
This was the place where fake_task was used in:
https://lkml.kernel.org/r/20181009092434.26221-6-juri.lelli@xxxxxxxxxx
+migrate_task:
...
+ }
+ rq->proxy = &fake_task; <-- !!!
+
+ for (; p; p = p->blocked_task) {
>>> + rq->proxy = rq->idle;
We use `rq->idle` now,
[...]
>>> + rq_unpin_lock(rq, rf);
>>> + raw_spin_rq_unlock(rq);
>>
>> Don't we run into rq_pin_lock()'s:
>>
>> SCHED_WARN_ON(rq->balance_callback && rq->balance_callback !=
>> &balance_push_callback)
>>
>> by releasing rq lock between queue_balance_callback(, push_rt/dl_tasks)
>> and __balance_callbacks()?
>
> Apologies, I’m a bit lost here. The code you are responding to inline does not call rq_pin_lock, it calls rq_unpin_lock. So what scenario does the warning trigger according to you?
True, but the code which sneaks in between proxy()'s
raw_spin_rq_unlock(rq) and raw_spin_rq_lock(rq) does.
__schedule()
rq->proxy = next = pick_next_task()
__pick_next_task()
pick_next_task_rt()
set_next_task_rt()
rt_queue_push_tasks()
queue_balance_callback(..., push_rt_tasks); <-- queue rt cb
proxy()
raw_spin_rq_unlock(rq)
... <-- other thread does rq_lock_XXX(rq)
raw_spin_rq_lock_XXX(rq)
rq_pin_lock(rq)
raw_spin_rq_lock(rq)
context_switch()
finish_task_switch()
finish_lock_switch()
__balance_callbacks(rq) <-- run rt cb here
__balance_callbacks(rq)() <-- or run rt cb here