Changeset 3b68542 in mainline


Ignore:
Timestamp:
2024-01-14T17:44:54Z (4 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
4760793
Parents:
6677acb
Message:

Eliminate an undefined behavior in scheduler debug printout

The .relink_deadline field is only normally accessed by the local CPU
and is not synchronized in any way. This is technically undefined
behavior, even if the only realistic failure mode I can think of here
is the output value being nonsense. Because the printed out value has
next to no utility to anyone using the command, simply remove it
instead of ignoring the issue or making the variable atomic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/scheduler.c

    r6677acb r3b68542  
    686686                        continue;
    687687
    688                 /* Technically a data race, but we don't really care in this case. */
    689                 int needs_relink = cpus[cpu].relink_deadline - cpus[cpu].current_clock_tick;
    690 
    691                 printf("cpu%u: address=%p, nrdy=%zu, needs_relink=%d\n",
    692                     cpus[cpu].id, &cpus[cpu], atomic_load(&cpus[cpu].nrdy),
    693                     needs_relink);
     688                printf("cpu%u: address=%p, nrdy=%zu\n",
     689                    cpus[cpu].id, &cpus[cpu], atomic_load(&cpus[cpu].nrdy));
    694690
    695691                unsigned int i;
Note: See TracChangeset for help on using the changeset viewer.