Changeset 11b285d in mainline for kernel/test


Ignore:
Timestamp:
2018-05-13T15:19:32Z (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:
ad896eb
Parents:
13db2044
git-author:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-05-13 14:59:01)
git-committer:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-05-13 15:19:32)
Message:

Use standard signature for malloc() in kernel.

The remaining instances of blocking allocation are replaced with
a new separate function named nfmalloc (short for non-failing malloc).

Location:
kernel/test
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/test/cht/cht1.c

    r13db2044 r11b285d  
    110110
    111111        for (int i = 0; i < val_cnt; ++i)
    112                 v[i] = malloc(sizeof(val_t), 0);
     112                v[i] = nfmalloc(sizeof(val_t));
    113113
    114114        size_t key[] = { 1, 1, 1, 11, 12, 13 };
     
    316316                TPRINTF("I{");
    317317                for (size_t i = 0; i < work->wave_elems; ++i) {
    318                         stress_t *s = malloc(sizeof(stress_t), FRAME_ATOMIC);
     318                        stress_t *s = malloc(sizeof(stress_t));
    319319                        if (!s) {
    320320                                TPRINTF("[out-of-mem]\n");
     
    473473
    474474        TPRINTF("Alloc and init table items. \n");
    475         void *p = malloc(size, FRAME_ATOMIC);
     475        void *p = malloc(size);
    476476        if (!p) {
    477477                TPRINTF("Failed to alloc items\n");
  • kernel/test/mm/falloc1.c

    r13db2044 r11b285d  
    4747
    4848        uintptr_t *frames = (uintptr_t *)
    49             malloc(MAX_FRAMES * sizeof(uintptr_t), FRAME_ATOMIC);
     49            malloc(MAX_FRAMES * sizeof(uintptr_t));
    5050        if (frames == NULL)
    5151                return "Unable to allocate frames";
  • kernel/test/mm/falloc2.c

    r13db2044 r11b285d  
    5353
    5454        uintptr_t *frames = (uintptr_t *)
    55             malloc(MAX_FRAMES * sizeof(uintptr_t), FRAME_ATOMIC);
     55            malloc(MAX_FRAMES * sizeof(uintptr_t));
    5656        if (frames == NULL) {
    5757                TPRINTF("Thread #%" PRIu64 " (cpu%u): "
  • kernel/test/synch/rcu1.c

    r13db2044 r11b285d  
    251251{
    252252        for (int i = 0; i < nop_updater_iters; i += 2) {
    253                 rcu_item_t *a = malloc(sizeof(rcu_item_t), FRAME_ATOMIC);
    254                 rcu_item_t *b = malloc(sizeof(rcu_item_t), FRAME_ATOMIC);
     253                rcu_item_t *a = malloc(sizeof(rcu_item_t));
     254                rcu_item_t *b = malloc(sizeof(rcu_item_t));
    255255
    256256                if (a && b) {
     
    315315        rcu_read_lock();
    316316
    317         item_w_cookie_t *item = malloc(sizeof(item_w_cookie_t), FRAME_ATOMIC);
     317        item_w_cookie_t *item = malloc(sizeof(item_w_cookie_t));
    318318
    319319        if (item) {
     
    420420                /* Updater */
    421421                for (size_t i = 0; i < work->update_cnt; ++i) {
    422                         seq_item_t *a = malloc(sizeof(seq_item_t), FRAME_ATOMIC);
    423                         seq_item_t *b = malloc(sizeof(seq_item_t), FRAME_ATOMIC);
     422                        seq_item_t *a = malloc(sizeof(seq_item_t));
     423                        seq_item_t *b = malloc(sizeof(seq_item_t));
    424424
    425425                        if (a && b) {
     
    523523        TPRINTF("\nReader exits thread with rcu_lock\n");
    524524
    525         exited_t *p = malloc(sizeof(exited_t), FRAME_ATOMIC);
     525        exited_t *p = malloc(sizeof(exited_t));
    526526        if (!p) {
    527527                TPRINTF("[out-of-mem]\n");
     
    686686static bool do_one_reader_preempt(void (*f)(void *), const char *err)
    687687{
    688         preempt_t *p = malloc(sizeof(preempt_t), FRAME_ATOMIC);
     688        preempt_t *p = malloc(sizeof(preempt_t));
    689689        if (!p) {
    690690                TPRINTF("[out-of-mem]\n");
     
    777777        TPRINTF("\nSynchronize with long reader\n");
    778778
    779         synch_t *synch = malloc(sizeof(synch_t), FRAME_ATOMIC);
     779        synch_t *synch = malloc(sizeof(synch_t));
    780780
    781781        if (!synch) {
     
    828828        TPRINTF("\nrcu_barrier: Wait for outstanding rcu callbacks to complete\n");
    829829
    830         barrier_t *barrier = malloc(sizeof(barrier_t), FRAME_ATOMIC);
     830        barrier_t *barrier = malloc(sizeof(barrier_t));
    831831
    832832        if (!barrier) {
     
    886886
    887887        for (size_t i = 0; i < s->iters; ++i) {
    888                 rcu_item_t *item = malloc(sizeof(rcu_item_t), FRAME_ATOMIC);
     888                rcu_item_t *item = malloc(sizeof(rcu_item_t));
    889889
    890890                if (item) {
  • kernel/test/synch/workq-test-core.h

    r13db2044 r11b285d  
    7272static test_work_t *create_child(test_work_t *work)
    7373{
    74         test_work_t *child = malloc(sizeof(test_work_t), 0);
     74        test_work_t *child = nfmalloc(sizeof(test_work_t));
    7575        assert(child);
    7676        if (child) {
     
    152152        }
    153153
    154         test_work_t *work = malloc(sizeof(test_work_t), 0);
     154        test_work_t *work = nfmalloc(sizeof(test_work_t));
    155155
    156156        work->master = true;
Note: See TracChangeset for help on using the changeset viewer.