lkml.org 
[lkml]   [2022]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2] kernel/sched: Update schedstats when migrating threads
From
On 2/24/2022 8:03 AM, Phil Auld wrote:
> On Wed, Feb 23, 2022 at 10:13:50AM -0600 Carlos Bilbao wrote:
>> The kernel manages per-task scheduler statistics or schedstats. Update
>> function migrate_task_to() to increase the counter for migrations.
>>
>> Signed-off-by: Carlos Bilbao <carlos.bilbao@amd.com>
>> ---
>> Changelog:
>> v2: Update commit message, don't reinitialize sched fields.
>> ---
>> kernel/sched/core.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>> index fcf0c180617c..1360e501c737 100644
>> --- a/kernel/sched/core.c
>> +++ b/kernel/sched/core.c
>> @@ -8751,7 +8751,7 @@ int migrate_task_to(struct task_struct *p, int target_cpu)
>> if (!cpumask_test_cpu(target_cpu, p->cpus_ptr))
>> return -EINVAL;
>>
>> - /* TODO: This is not properly updating schedstats */
>> + schedstat_inc(p->stats.nr_migrations_cold);
>>
>
> I was going to give a reviewed by since I was looking at this,
> but I can't convince myself that nr_migrations_cold is right.
> This looks more like a "hot" migration (using stop_cpu to force
> it). But nr_migrations_cold is not incremented anywhere else so
> maybe it's a terminology thing.
>
> Can you tell me why this is the right counter?
>
>
The alternative to nr_migrations_cold is nr_forced_migrations, and since
we call this function in the context of NUMA balancing it didn't seem like
an appropriate fit at first glance. But documentation in this is scarce and
I'm not very confident with the terminology either. Maybe Ingo Molar -the
original author of the structure- can clarify the specifics of these two
counters so we can be sure about this? Maybe we need a new counter?

> Thanks,
> Phil
>
>
>> trace_sched_move_numa(p, curr_cpu, target_cpu);
>> return stop_one_cpu(curr_cpu, migration_cpu_stop, &arg);
>> --
>> 2.27.0
>>
>

Thanks,
Carlos

\
 
 \ /
  Last update: 2022-02-24 16:06    [W:0.699 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site