Changeset efed95a3 in mainline for kernel/generic/src/sysinfo/stats.c


Ignore:
Timestamp:
2024-01-20T17:09:00Z (4 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
3d84734
Parents:
286da52
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2024-01-20 16:12:46)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2024-01-20 17:09:00)
Message:

Make thread→cpu weakly atomic, to avoid need for thread lock

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/sysinfo/stats.c

    r286da52 refed95a3  
    308308        stats_thread->kcycles = thread->kcycles;
    309309
    310         if (thread->cpu != NULL) {
     310        cpu_t *cpu = atomic_get_unordered(&thread->cpu);
     311
     312        if (cpu != NULL) {
    311313                stats_thread->on_cpu = true;
    312                 stats_thread->cpu = thread->cpu->id;
     314                stats_thread->cpu = cpu->id;
    313315        } else
    314316                stats_thread->on_cpu = false;
Note: See TracChangeset for help on using the changeset viewer.