Changeset 036e97c in mainline for kernel/generic/src


Ignore:
Timestamp:
2018-09-07T15:52:40Z (7 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:
e3306d04
Parents:
e9d2905
Message:

Convert atomic_t to atomic_size_t (3): Use atomic_load instead of atomic_get

Location:
kernel/generic/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/adt/cht.c

    re9d2905 r036e97c  
    618618
    619619        /* You must clear the table of items. Otherwise cht_destroy will leak. */
    620         assert(atomic_get(&h->item_cnt) == 0);
     620        assert(atomic_load(&h->item_cnt) == 0);
    621621}
    622622
     
    625625{
    626626        /* Wait for resize to complete. */
    627         while (0 < atomic_get(&h->resize_reqs)) {
     627        while (0 < atomic_load(&h->resize_reqs)) {
    628628                rcu_barrier();
    629629        }
     
    21602160        /* Make resize_reqs visible. */
    21612161        read_barrier();
    2162         assert(0 < atomic_get(&h->resize_reqs));
     2162        assert(0 < atomic_load(&h->resize_reqs));
    21632163#endif
    21642164
     
    21682168                /* Load the most recent h->item_cnt. */
    21692169                read_barrier();
    2170                 size_t cur_items = (size_t) atomic_get(&h->item_cnt);
     2170                size_t cur_items = (size_t) atomic_load(&h->item_cnt);
    21712171                size_t bucket_cnt = (1 << h->b->order);
    21722172                size_t max_items = h->max_load * bucket_cnt;
  • kernel/generic/src/console/chardev.c

    re9d2905 r036e97c  
    9494wchar_t indev_pop_character(indev_t *indev)
    9595{
    96         if (atomic_get(&haltstate)) {
     96        if (atomic_load(&haltstate)) {
    9797                /*
    9898                 * If we are here, we are hopefully on the processor that
  • kernel/generic/src/console/console.c

    re9d2905 r036e97c  
    292292void kio_update(void *event)
    293293{
    294         if (!atomic_get(&kio_inited))
     294        if (!atomic_load(&kio_inited))
    295295                return;
    296296
  • kernel/generic/src/ipc/ipc.c

    re9d2905 r036e97c  
    783783static void ipc_wait_for_all_answered_calls(void)
    784784{
    785         while (atomic_get(&TASK->answerbox.active_calls) != 0) {
     785        while (atomic_load(&TASK->answerbox.active_calls) != 0) {
    786786                call_t *call = NULL;
    787787                if (ipc_wait_for_call(&TASK->answerbox,
     
    873873        ipc_wait_for_all_answered_calls();
    874874
    875         assert(atomic_get(&TASK->answerbox.active_calls) == 0);
     875        assert(atomic_load(&TASK->answerbox.active_calls) == 0);
    876876}
    877877
     
    928928        if (phone->state != IPC_PHONE_FREE) {
    929929                printf("%-11d %7" PRIun " ", (int) CAP_HANDLE_RAW(cap->handle),
    930                     atomic_get(&phone->active_calls));
     930                    atomic_load(&phone->active_calls));
    931931
    932932                switch (phone->state) {
     
    981981
    982982        printf("Active calls: %" PRIun "\n",
    983             atomic_get(&task->answerbox.active_calls));
     983            atomic_load(&task->answerbox.active_calls));
    984984
    985985#ifdef __32_BITS__
  • kernel/generic/src/ipc/sysipc.c

    re9d2905 r036e97c  
    341341static int check_call_limit(phone_t *phone)
    342342{
    343         if (atomic_get(&phone->active_calls) >= IPC_MAX_ASYNC_CALLS)
     343        if (atomic_load(&phone->active_calls) >= IPC_MAX_ASYNC_CALLS)
    344344                return -1;
    345345
  • kernel/generic/src/lib/halt.c

    re9d2905 r036e97c  
    5656        bool rundebugger = false;
    5757
    58         if (!atomic_get(&haltstate)) {
     58        if (!atomic_load(&haltstate)) {
    5959                atomic_set(&haltstate, 1);
    6060                rundebugger = true;
  • kernel/generic/src/log/log.c

    re9d2905 r036e97c  
    190190static void log_update(void *event)
    191191{
    192         if (!atomic_get(&log_inited))
     192        if (!atomic_load(&log_inited))
    193193                return;
    194194
  • kernel/generic/src/mm/slab.c

    re9d2905 r036e97c  
    690690         * endless loop
    691691         */
    692         atomic_count_t magcount = atomic_get(&cache->magazine_counter);
     692        atomic_count_t magcount = atomic_load(&cache->magazine_counter);
    693693
    694694        slab_magazine_t *mag;
     
    876876                size_t size = cache->size;
    877877                size_t objects = cache->objects;
    878                 long allocated_slabs = atomic_get(&cache->allocated_slabs);
    879                 long cached_objs = atomic_get(&cache->cached_objs);
    880                 long allocated_objs = atomic_get(&cache->allocated_objs);
     878                long allocated_slabs = atomic_load(&cache->allocated_slabs);
     879                long cached_objs = atomic_load(&cache->cached_objs);
     880                long allocated_objs = atomic_load(&cache->allocated_objs);
    881881                unsigned int flags = cache->flags;
    882882
  • kernel/generic/src/proc/scheduler.c

    re9d2905 r036e97c  
    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
     
    531531            "cpu%u: tid %" PRIu64 " (priority=%d, ticks=%" PRIu64
    532532            ", nrdy=%zu)", CPU->id, THREAD->tid, THREAD->priority,
    533             THREAD->ticks, atomic_get(&CPU->nrdy));
     533            THREAD->ticks, atomic_load(&CPU->nrdy));
    534534#endif
    535535
     
    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)
     
    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.
     
    740740
    741741                printf("cpu%u: address=%p, nrdy=%zu, needs_relink=%zu\n",
    742                     cpus[cpu].id, &cpus[cpu], atomic_get(&cpus[cpu].nrdy),
     742                    cpus[cpu].id, &cpus[cpu], atomic_load(&cpus[cpu].nrdy),
    743743                    cpus[cpu].needs_relink);
    744744
  • kernel/generic/src/proc/task.c

    re9d2905 r036e97c  
    620620        if (*additional)
    621621                printf("%-8" PRIu64 " %9zu", task->taskid,
    622                     atomic_get(&task->refcount));
     622                    atomic_load(&task->refcount));
    623623        else
    624624                printf("%-8" PRIu64 " %-14s %-5" PRIu32 " %10p %10p"
     
    632632                printf("%-8" PRIu64 " %9" PRIu64 "%c %9" PRIu64 "%c "
    633633                    "%9zu\n", task->taskid, ucycles, usuffix, kcycles,
    634                     ksuffix, atomic_get(&task->refcount));
     634                    ksuffix, atomic_load(&task->refcount));
    635635        else
    636636                printf("%-8" PRIu64 " %-14s %-5" PRIu32 " %18p %18p\n",
  • kernel/generic/src/smp/smp_call.c

    re9d2905 r036e97c  
    271271                 */
    272272                memory_barrier();
    273         } while (atomic_get(&call_info->pending));
     273        } while (atomic_load(&call_info->pending));
    274274}
    275275
  • kernel/generic/src/synch/rcu.c

    re9d2905 r036e97c  
    14771477static bool wait_for_delaying_cpus(void)
    14781478{
    1479         int delaying_cpu_cnt = atomic_get(&rcu.delaying_cpu_cnt);
     1479        int delaying_cpu_cnt = atomic_load(&rcu.delaying_cpu_cnt);
    14801480
    14811481        for (int i = 0; i < delaying_cpu_cnt; ++i) {
  • kernel/generic/src/sysinfo/stats.c

    re9d2905 r036e97c  
    239239        stats_task->virtmem = get_task_virtmem(task->as);
    240240        stats_task->resmem = get_task_resmem(task->as);
    241         stats_task->threads = atomic_get(&task->refcount);
     241        stats_task->threads = atomic_load(&task->refcount);
    242242        task_get_accounting(task, &(stats_task->ucycles),
    243243            &(stats_task->kcycles));
     
    784784
    785785        while (true) {
    786                 atomic_count_t ready = atomic_get(&nrdy);
     786                atomic_count_t ready = atomic_load(&nrdy);
    787787
    788788                /* Mutually exclude with get_stats_load() */
Note: See TracChangeset for help on using the changeset viewer.