Changeset 1c1da4b in mainline


Ignore:
Timestamp:
2012-07-16T15:38:45Z (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:
0ca7286
Parents:
0cf813d
Message:

rcu: Cleaned up rcu1 test a bit. Now it uses wired threads.

File:
1 edited

Legend:

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

    r0cf813d r1c1da4b  
    5050} exited_t;
    5151
     52/* Callback raced with preexisting readers. */
    5253#define ERACE   123
     54/* Waited for too long for the callback to exit; consider it lost. */
    5355#define ECBLOST 432
    5456
     
    8587               
    8688        if(thread[k]) {
    87                 /* Try to distribute evenly but allow migration. */
    88                 thread[k]->cpu = &cpus[k % config.cpu_active];
     89                /* Distribute evenly. */
     90                thread_wire(thread[k], &cpus[k % config.cpu_active]);
    8991                thread_ready(thread[k]);
    9092        }
     
    208210               
    209211                for (volatile size_t k = 0; k < nop_iters; ++k) {
    210                         // nop, but increment volatile k                       
     212                        /* nop, but increment volatile k */
    211213                }
    212214               
     
    338340        join_one();
    339341       
    340         TPRINTF("\nJoined one-cb reader, wait for cb.\n");
     342        TPRINTF("\nJoined one-cb reader, wait for callback.\n");
    341343        size_t loop_cnt = 0;
    342         size_t max_loops = 4; /* 200 ms */
     344        size_t max_loops = 4; /* 200 ms total */
    343345       
    344346        while (!one_cb_is_done && loop_cnt < max_loops) {
     
    526528       
    527529        int result = EOK;
    528         wait_for_cb_exit(2, p, &result);
     530        wait_for_cb_exit(2 /* secs */, p, &result);
    529531       
    530532        if (result != EOK) {
     
    689691        join_one();
    690692       
     693        /* Wait at most 4 secs. */
    691694        wait_for_cb_exit(4, &p->e, &p->result);
    692695       
     
    703706static bool do_reader_preempt(void)
    704707{
    705         TPRINTF("\nReader preempts; after GP start, before GP, twice before GP\n");
     708        TPRINTF("\nReaders will be preempted.\n");
    706709       
    707710        bool success = true;
     
    744747        rcu_read_lock();
    745748
    746         /* Contain synch accessing after reader section beginning. */
     749        /* Order accesses of synch after the reader section begins. */
    747750        memory_barrier();
    748751       
     
    750753       
    751754        while (!synch->synch_running) {
    752                 /* 0.5 sec*/
     755                /* 0.5 sec */
    753756                delay(500 * 1000);
    754757        }
     
    829832{
    830833        /* 5 us * 1000 * 1000 iters == 5 sec per updater thread */
    831         /*delay(5);*/
     834        delay(5);
    832835        free(item);
    833836}
     
    847850                }
    848851               
    849                 /* Print a dot if we make progress of 1% */
    850                 if (s->master && 0 == (i % (s->iters/100 + 1)))
     852                /* Print a dot if we make a progress of 1% */
     853                if (s->master && 0 == (i % (s->iters/100)))
    851854                        TPRINTF(".");
    852855        }
     
    855858static bool do_stress(void)
    856859{
    857         //size_t cb_per_thread = 1000 * 1000;
    858860        size_t cb_per_thread = 1000 * 1000;
    859861        bool done = false;
     
    861863        stress_t worker = { .iters = cb_per_thread, .master = false };
    862864       
    863         size_t thread_cnt = min(MAX_THREADS, config.cpu_active);
     865        size_t thread_cnt = min(MAX_THREADS / 2, config.cpu_active);
    864866        /* Each cpu has one reader and one updater. */
    865867        size_t reader_cnt = thread_cnt;
     
    873875        bin_order_suffix(max_used_mem, &mem_units, &mem_suffix, false);
    874876
    875         TPRINTF("\nStress: Run %zu nop-readers and %zu updaters. %zu callbacks "
     877        TPRINTF("\nStress: Run %zu nop-readers and %zu updaters. %zu callbacks"
    876878                " total (max %" PRIu64 " %s used). Be very patient.\n",
    877879                reader_cnt, updater_cnt, exp_upd_calls, mem_units, mem_suffix);
     
    914916                --e->count_down;
    915917               
    916                 if (0 == (e->count_down % (e->total_cnt/100 + 1))) {
     918                if (0 == (e->count_down % (e->total_cnt/100))) {
    917919                        TPRINTF("*");
    918920                }
Note: See TracChangeset for help on using the changeset viewer.