Changeset 0594c7ea in mainline for kernel/test/synch/rcu1.c


Ignore:
Timestamp:
2012-07-12T18:31:10Z (12 years ago)
Author:
Adam Hraska <adam.hraska+hos@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
057e77f
Parents:
e25eb9e3
Message:

rcu: Changed mallocs in test rcu1 to use nonblocking ATOMIC_FRAME flag.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/test/synch/rcu1.c

    re25eb9e3 r0594c7ea  
    250250{
    251251        for (int i = 0; i < nop_updater_iters; i += 2){
    252                 rcu_item_t *a = malloc(sizeof(rcu_item_t), 0);
    253                 rcu_item_t *b = malloc(sizeof(rcu_item_t), 0);
     252                rcu_item_t *a = malloc(sizeof(rcu_item_t), FRAME_ATOMIC);
     253                rcu_item_t *b = malloc(sizeof(rcu_item_t), FRAME_ATOMIC);
    254254               
    255255                if (a && b) {
     
    257257                        rcu_call(b, count_cb);
    258258                } else {
     259                        TPRINTF("[out-of-mem]\n");
    259260                        free(a);
    260261                        free(b);
     262                        return;
    261263                }
    262264        }
     
    312314        rcu_read_lock();
    313315       
    314         item_w_cookie_t *item = malloc(sizeof(item_w_cookie_t), 0);
     316        item_w_cookie_t *item = malloc(sizeof(item_w_cookie_t), FRAME_ATOMIC);
    315317       
    316318        if (item) {
     
    412414                /* Updater */
    413415                for (size_t i = 0; i < work->update_cnt; ++i) {
    414                         seq_item_t *a = malloc(sizeof(seq_item_t), 0);
    415                         seq_item_t *b = malloc(sizeof(seq_item_t), 0);
     416                        seq_item_t *a = malloc(sizeof(seq_item_t), FRAME_ATOMIC);
     417                        seq_item_t *b = malloc(sizeof(seq_item_t), FRAME_ATOMIC);
    416418                       
    417419                        if (a && b) {
     
    512514        TPRINTF("\nReader exits thread with rcu_lock\n");
    513515       
    514         exited_t *p = malloc(sizeof(exited_t), 0);
     516        exited_t *p = malloc(sizeof(exited_t), FRAME_ATOMIC);
     517        if (!p) {
     518                TPRINTF("[out-of-mem]\n");
     519                return false;
     520        }
     521               
    515522        p->exited = false;
    516523       
     
    670677static bool do_one_reader_preempt(void (*f)(void*), const char *err)
    671678{
    672         preempt_t *p = malloc(sizeof(preempt_t), 0);
    673         ASSERT(p);
     679        preempt_t *p = malloc(sizeof(preempt_t), FRAME_ATOMIC);
     680        if (!p) {
     681                TPRINTF("[out-of-mem]\n");
     682                return false;
     683        }
     684       
    674685        p->e.exited = false;
    675686        p->result = EOK;
     
    756767        TPRINTF("\nSynchronize with long reader\n");
    757768       
    758         synch_t *synch = malloc(sizeof(synch_t), 0);
     769        synch_t *synch = malloc(sizeof(synch_t), FRAME_ATOMIC);
    759770       
    760771        if (!synch) {
     772                TPRINTF("[out-of-mem]\n");
    761773                return false;
    762774        }
     
    826838       
    827839        for (size_t i = 0; i < s->iters; ++i) {
    828                 rcu_item_t *item = malloc(sizeof(rcu_item_t), 0);
    829                
    830                 if (item)
     840                rcu_item_t *item = malloc(sizeof(rcu_item_t), FRAME_ATOMIC);
     841               
     842                if (item) {
    831843                        rcu_call(item, stress_cb);
     844                } else {
     845                        TPRINTF("[out-of-mem]\n");
     846                        return;
     847                }
    832848               
    833849                /* Print a dot if we make progress of 1% */
Note: See TracChangeset for help on using the changeset viewer.