Changeset fc10e1b in mainline for kernel/test/synch/rcu1.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/test/synch/rcu1.c

    r508b0df1 rfc10e1b  
    238238
    239239
    240 static atomic_t nop_callbacks_cnt = { 0 };
     240static atomic_t nop_callbacks_cnt = 0;
    241241/* Must be even. */
    242242static const int nop_updater_iters = 10000;
     
    268268static bool do_nop_callbacks(void)
    269269{
    270         atomic_set(&nop_callbacks_cnt, 0);
     270        atomic_store(&nop_callbacks_cnt, 0);
    271271
    272272        size_t exp_cnt = nop_updater_iters * get_thread_cnt();
     
    282282        size_t loop_cnt = 0, max_loops = 15;
    283283
    284         while (exp_cnt != atomic_get(&nop_callbacks_cnt) && loop_cnt < max_loops) {
     284        while (exp_cnt != atomic_load(&nop_callbacks_cnt) && loop_cnt < max_loops) {
    285285                ++loop_cnt;
    286286                TPRINTF(".");
     
    361361typedef struct {
    362362        rcu_item_t rcu;
    363         atomic_count_t start_time;
     363        size_t start_time;
    364364} seq_item_t;
    365365
     
    367367static errno_t seq_test_result = EOK;
    368368
    369 static atomic_t cur_time = { 1 };
    370 static atomic_count_t max_upd_done_time = { 0 };
     369static atomic_t cur_time = 1;
     370static size_t max_upd_done_time = { 0 };
    371371
    372372static void seq_cb(rcu_item_t *rcu_item)
     
    399399                for (size_t i = 0; i < work->read_cnt; ++i) {
    400400                        rcu_read_lock();
    401                         atomic_count_t start_time = atomic_postinc(&cur_time);
     401                        size_t start_time = atomic_postinc(&cur_time);
    402402
    403403                        for (volatile size_t d = 0; d < 10 * i; ++d) {
     
    448448        seq_test_result = EOK;
    449449        max_upd_done_time = 0;
    450         atomic_set(&cur_time, 1);
     450        atomic_store(&cur_time, 1);
    451451
    452452        const size_t iters = 100;
     
    821821{
    822822        barrier_t *b = member_to_inst(item, barrier_t, rcu_item);
    823         atomic_set(&b->done, 1);
     823        atomic_store(&b->done, 1);
    824824}
    825825
     
    835835        }
    836836
    837         atomic_set(&barrier->done, 0);
     837        atomic_store(&barrier->done, 0);
    838838
    839839        rcu_call(&barrier->rcu_item, barrier_callback);
    840840        rcu_barrier();
    841841
    842         if (1 == atomic_get(&barrier->done)) {
     842        if (1 == atomic_load(&barrier->done)) {
    843843                free(barrier);
    844844                return true;
Note: See TracChangeset for help on using the changeset viewer.