Changeset fc10e1b in mainline for kernel/generic/src/proc/scheduler.c


Ignore:
Timestamp:
2018-09-07T16:34:11Z (6 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d2c91ab
Parents:
508b0df1 (diff), e90cfa6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'atomic'

Use more of <stdatomic.h> in kernel. Increment/decrement macros kept because
the are handy. atomic_t currently kept because I'm way too lazy to go through
all uses and think about the most appropriate replacement.

File:
1 edited

Legend:

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

    r508b0df1 rfc10e1b  
    205205loop:
    206206
    207         if (atomic_get(&CPU->nrdy) == 0) {
     207        if (atomic_load(&CPU->nrdy) == 0) {
    208208                /*
    209209                 * For there was nothing to run, the CPU goes to sleep
     
    327327        ipl = interrupts_disable();
    328328
    329         if (atomic_get(&haltstate))
     329        if (atomic_load(&haltstate))
    330330                halt();
    331331
     
    530530        log(LF_OTHER, LVL_DEBUG,
    531531            "cpu%u: tid %" PRIu64 " (priority=%d, ticks=%" PRIu64
    532             ", nrdy=%" PRIua ")", CPU->id, THREAD->tid, THREAD->priority,
    533             THREAD->ticks, atomic_get(&CPU->nrdy));
     532            ", nrdy=%zu)", CPU->id, THREAD->tid, THREAD->priority,
     533            THREAD->ticks, atomic_load(&CPU->nrdy));
    534534#endif
    535535
     
    566566void kcpulb(void *arg)
    567567{
    568         atomic_count_t average;
    569         atomic_count_t rdy;
     568        size_t average;
     569        size_t rdy;
    570570
    571571        /*
     
    587587         *
    588588         */
    589         average = atomic_get(&nrdy) / config.cpu_active + 1;
    590         rdy = atomic_get(&CPU->nrdy);
     589        average = atomic_load(&nrdy) / config.cpu_active + 1;
     590        rdy = atomic_load(&CPU->nrdy);
    591591
    592592        if (average <= rdy)
    593593                goto satisfied;
    594594
    595         atomic_count_t count = average - rdy;
     595        size_t count = average - rdy;
    596596
    597597        /*
     
    616616                                continue;
    617617
    618                         if (atomic_get(&cpu->nrdy) <= average)
     618                        if (atomic_load(&cpu->nrdy) <= average)
    619619                                continue;
    620620
     
    678678                                    "kcpulb%u: TID %" PRIu64 " -> cpu%u, "
    679679                                    "nrdy=%ld, avg=%ld", CPU->id, t->tid,
    680                                     CPU->id, atomic_get(&CPU->nrdy),
    681                                     atomic_get(&nrdy) / config.cpu_active);
     680                                    CPU->id, atomic_load(&CPU->nrdy),
     681                                    atomic_load(&nrdy) / config.cpu_active);
    682682#endif
    683683
     
    705705        }
    706706
    707         if (atomic_get(&CPU->nrdy)) {
     707        if (atomic_load(&CPU->nrdy)) {
    708708                /*
    709709                 * Be a little bit light-weight and let migrated threads run.
     
    739739                irq_spinlock_lock(&cpus[cpu].lock, true);
    740740
    741                 printf("cpu%u: address=%p, nrdy=%" PRIua ", needs_relink=%zu\n",
    742                     cpus[cpu].id, &cpus[cpu], atomic_get(&cpus[cpu].nrdy),
     741                printf("cpu%u: address=%p, nrdy=%zu, needs_relink=%zu\n",
     742                    cpus[cpu].id, &cpus[cpu], atomic_load(&cpus[cpu].nrdy),
    743743                    cpus[cpu].needs_relink);
    744744
Note: See TracChangeset for help on using the changeset viewer.