Re: [PATCH v3] perf sched timehist: Add pre-migration wait time option
From: Madadi Vineeth Reddy
Date: Fri Oct 04 2024 - 02:58:55 EST
On 04/10/24 03:49, Namhyung Kim wrote:
> On Thu, Oct 03, 2024 at 03:04:28PM -0700, Tim Chen wrote:
>> On Wed, 2024-10-02 at 22:09 +0530, Madadi Vineeth Reddy wrote:
>>> pre-migration wait time is the time that a task unnecessarily spends
>>> on the runqueue of a CPU but doesn't get switched-in there. In terms
>>> of tracepoints, it is the time between sched:sched_wakeup and
>>> sched:sched_migrate_task.
>>>
>>> Let's say a task woke up on CPU2, then it got migrated to CPU4 and
>>> then it's switched-in to CPU4. So, here pre-migration wait time is
>>> time that it was waiting on runqueue of CPU2 after it is woken up.
>>>
>>> The general pattern for pre-migration to occur is:
>>> sched:sched_wakeup
>>> sched:sched_migrate_task
>>> sched:sched_switch
>>
>> If a task migrate from CPU A to CPU B, but is unlucky that
>> someone took CPU B and it has to wait. Then it is yet again migrated to CPU C.
>> Do you only compute pre-mig time as
>> t_sched_migrate_task_CPU_A - t_sched_migrate_task_CPU_A?
>>
>> The task also spend some pre-mig time on CPU_B that probably
>> should be included. And that time is when it migrates to B
>> till it is migrated away from B. Do you take that into
>> account?
>
> Hmm.. right. The current code updates the migrate time only if it's 0.
> But I think it can just always update the time to get the latest one.
>
Right. I’ll update the code to always pick the latest migrate time, ensuring
that scenarios with multiple migrations in between are handled correctly.
Thanks,
Madadi Vineeth Reddy
> Thanks,
> Namhyung