Re: Scheduling tasks on idle cpu
From: Qais Yousef
Date: Mon Apr 11 2022 - 19:35:01 EST
On 04/11/22 08:26, David Laight wrote:
> From: Qais Yousef
> > Sent: 09 April 2022 18:09
> ...
> > RT scheduler will push/pull tasks to ensure the task will get to run ASAP if
> > there's another cpu at lower priority is available
>
> Does that actually happen?
For RT tasks, yes. They should get distributed.
> I've seen the following:
> 34533 [017]: sys_futex(uaddr: 1049104, op: 85, val: 1, utime: 1, uaddr2: 1049100, val3: 4000001)
> 34533 [017]: sched_migrate_task: pid=34512 prio=120 orig_cpu=14 dest_cpu=17
> 34533 [017]: sched_wakeup: pid=34512 prio=120 success=1 target_cpu=017
prio=120 is a CFS task, no?
> and pid 34512 doesn't get scheduled until pid 34533 finally sleeps.
> This is in spite of there being 5 idle cpu.
> cpu 14 is busy running a RT thread, but migrating to cpu 17 seems wrong.
>
> This is on a RHEL7 kernel, I've not replicated it on anything recent.
> But I've very much like a RT thread to be able to schedule a non-RT
> thread to run on an idle cpu.
Oh, you want CFS to avoid CPUs that are running RT tasks.
We had a proposal in the past, but it wasn't good enough
https://lore.kernel.org/lkml/1567048502-6064-1-git-send-email-jing-ting.wu@xxxxxxxxxxxx/
The approach in that patch modified RT to avoid CFS actually.
Can you verify whether the RT task woke up after task 34512 was migrated to CPU
17? Looking at the definition of available_idle_cpu() we should have avoided
that CPU if the RT task was already running. Both waking up at the same time
would explain what you see. Otherwise I'm not sure why it picked CPU 17.
Thanks
--
Qais Yousef