Changeset 5b03a72 in mainline for kernel/generic/src


Ignore:
Timestamp:
2012-07-29T17:53:48Z (13 years ago)
Author:
Adam Hraska <adam.hraska+hos@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f0fcb04
Parents:
8e3ed06
Message:

rcu: Switched from using THREAD→nesting_cnt to CPU→nesting_cnt as the main nesting count variable. RCU no longer has to mess with pointers to the corrent nesting_cnt (and gets rid of one level of indirection when accessing the nesting count in reader sections).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/synch/rcu.c

    r8e3ed06 r5b03a72  
    225225        CPU->rcu.last_seen_gp = 0;
    226226       
    227         CPU->rcu.pnesting_cnt = &CPU->rcu.tmp_nesting_cnt;
    228         CPU->rcu.tmp_nesting_cnt = 0;
     227        CPU->rcu.nesting_cnt = 0;
    229228       
    230229        CPU->rcu.cur_cbs = 0;
     
    286285         * reader section nesting count while we examine/process it.
    287286         */
    288         ASSERT(&CPU->rcu.tmp_nesting_cnt == CPU->rcu.pnesting_cnt);
    289        
    290         /*
    291          * The thread forgot to exit its reader critical secion.
     287       
     288        /*
     289         * The thread forgot to exit its reader critical section.
    292290         * It is a bug, but rather than letting the entire system lock up
    293291         * forcefully leave the reader section. The thread is not holding
     
    373371{
    374372        preemption_disable();
    375         bool locked = 0 < *CPU->rcu.pnesting_cnt;
     373        bool locked = 0 < CPU->rcu.nesting_cnt;
    376374        preemption_enable();
    377375       
     
    483481{
    484482        /* Calling from a reader section will deadlock. */
    485         ASSERT(THREAD == 0 || 0 == THREAD->rcu.nesting_cnt);
     483        ASSERT(0 == CPU->rcu.nesting_cnt);
    486484       
    487485        synch_item_t completion;
     
    11991197        if (CPU->rcu.last_seen_gp != _rcu_cur_gp) {
    12001198                /* Interrupted a reader in a reader critical section. */
    1201                 if (0 < (*CPU->rcu.pnesting_cnt)) {
     1199                if (0 < CPU->rcu.nesting_cnt) {
    12021200                        ASSERT(!CPU->idle);
    12031201                        /* Note to notify the detector from rcu_read_unlock(). */
     
    12761274{
    12771275        ASSERT(interrupts_disabled());
    1278         ASSERT(CPU->rcu.pnesting_cnt == &THREAD->rcu.nesting_cnt);
     1276       
     1277        /* Save the thread's nesting count when its not running. */
     1278        THREAD->rcu.nesting_cnt = CPU->rcu.nesting_cnt;
     1279        /* Interrupt handlers might use RCU while idle in scheduler(). */
     1280        CPU->rcu.nesting_cnt = 0;
    12791281       
    12801282        /* Preempted a reader critical section for the first time. */
     
    13171319       
    13181320        /*
    1319          * After this point THREAD is 0 and stays 0 until the scheduler()
    1320          * switches to a new thread. Use a temporary nesting counter for readers
    1321          * in handlers of interrupts that are raised while idle in the scheduler.
    1322          */
    1323         CPU->rcu.pnesting_cnt = &CPU->rcu.tmp_nesting_cnt;
    1324 
    1325         /*
    13261321         * Forcefully associate the detector with the highest priority
    13271322         * even if preempted due to its time slice running out.
     
    13551350{
    13561351        ASSERT(PREEMPTION_DISABLED || interrupts_disabled());
    1357         ASSERT(&CPU->rcu.tmp_nesting_cnt == CPU->rcu.pnesting_cnt);
    1358        
    1359         CPU->rcu.pnesting_cnt = &THREAD->rcu.nesting_cnt;
     1352        ASSERT(0 == CPU->rcu.nesting_cnt);
     1353       
     1354        /* Load the thread's saved nesting count from before it was preempted. */
     1355        CPU->rcu.nesting_cnt = THREAD->rcu.nesting_cnt;
    13601356}
    13611357
Note: See TracChangeset for help on using the changeset viewer.