Changeset d4d36f9 in mainline for kernel/generic/include


Ignore:
Timestamp:
2012-07-30T05:23:06Z (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:
452e91b
Parents:
f0fcb04
Message:

rcu: Added another preemptible kernel rcu - A-RCU.

Location:
kernel/generic/include
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/arch.h

    rf0fcb04 rd4d36f9  
    3838#include <arch/arch.h>  /* arch_pre_main() */
    3939#include <arch/asm.h>   /* get_stack_base() */
     40#include <config.h>
    4041
    4142
     
    6970typedef struct {
    7071        size_t preemption;     /**< Preemption disabled counter and flag. */
     72#ifdef RCU_PREEMPT_A
     73        size_t rcu_nesting;    /**< RCU nesting count and flag. */
     74#endif
    7175        struct thread *thread; /**< Current thread. */
    7276        struct task *task;     /**< Current task. */
  • kernel/generic/include/synch/rcu.h

    rf0fcb04 rd4d36f9  
    123123extern void _rcu_synchronize(bool expedite);
    124124
     125
     126#ifdef RCU_PREEMPT_A
     127
     128#define RCU_CNT_INC       (1 << 1)
     129#define RCU_WAS_PREEMPTED (1 << 0)
     130
     131/* Fwd. decl. because of inlining. */
     132void _rcu_preempted_unlock(void);
     133
     134/** Delimits the start of an RCU reader critical section.
     135 *
     136 * Reader sections may be nested and are preemptable. You must not
     137 * however block/sleep within reader sections.
     138 */
     139static inline void rcu_read_lock(void)
     140{
     141        THE->rcu_nesting += RCU_CNT_INC;
     142}
     143
     144/** Delimits the end of an RCU reader critical section. */
     145static inline void rcu_read_unlock(void)
     146{
     147        THE->rcu_nesting -= RCU_CNT_INC;
     148       
     149        if (RCU_WAS_PREEMPTED == THE->rcu_nesting) {
     150                _rcu_preempted_unlock();
     151        }
     152}
     153
     154#elif defined(RCU_PREEMPT_PODZIMEK)
    125155
    126156/* Fwd decl. required by the inlined implementation. Not part of public API. */
     
    210240        preemption_enable();
    211241}
    212 
    213 
    214242#endif
    215243
     244#endif
     245
    216246/** @}
    217247 */
  • kernel/generic/include/synch/rcu_types.h

    rf0fcb04 rd4d36f9  
    3939#include <synch/semaphore.h>
    4040
     41#if !defined(RCU_PREEMPT_PODZIMEK) && !defined(RCU_PREEMPT_A)
     42#define RCU_PREEMPT_A
     43//#error You must select an RCU algorithm.
     44#endif
     45
    4146
    4247/* Fwd decl. */
     
    5863/** RCU related per-cpu data. */
    5964typedef struct rcu_cpu_data {
    60         /** The cpu recorded a quiescent state last time during this grace period */
     65        /** The cpu recorded a quiescent state last time during this grace period.*/
    6166        rcu_gp_t last_seen_gp;
     67
     68#ifdef RCU_PREEMPT_PODZIMEK
     69        /** This cpu has not yet passed a quiescent state and it is delaying the
     70         * detector. Once it reaches a QS it must sema_up(rcu.remaining_readers).
     71         */
     72        bool is_delaying_gp;
    6273       
     74        /** True if we should signal the detector that we exited a reader section.
     75         *
     76         * Equal to (THREAD->rcu.was_preempted || CPU->rcu.is_delaying_gp).
     77         */
     78        bool signal_unlock;
     79
    6380        /** The number of times an RCU reader section is nested on this cpu.
    6481         *
     
    6885         */
    6986        size_t nesting_cnt;
    70 
     87#endif
     88       
    7189        /** Callbacks to invoke once the current grace period ends, ie cur_cbs_gp.
    7290         * Accessed by the local reclaimer only.
     
    102120        rcu_gp_t next_cbs_gp;
    103121       
    104         /** This cpu has not yet passed a quiescent state and it is delaying the
    105          * detector. Once it reaches a QS it must sema_up(rcu.remaining_readers).
    106          */
    107         bool is_delaying_gp;
    108        
    109         /** True if we should signal the detector that we exited a reader section.
    110          *
    111          * Equal to (THREAD->rcu.was_preempted || CPU->rcu.is_delaying_gp).
    112          */
    113         bool signal_unlock;
    114        
    115122        /** Positive if there are callbacks pending in arriving_cbs. */
    116123        semaphore_t arrived_flag;
     
    142149         */
    143150        size_t nesting_cnt;
     151
     152#ifdef RCU_PREEMPT_PODZIMEK
    144153       
    145154        /** True if the thread was preempted in a reader section.
     
    151160         */
    152161        bool was_preempted;
     162#endif
     163       
    153164        /** Preempted threads link. Access with rcu.prempt_lock.*/
    154165        link_t preempt_link;
Note: See TracChangeset for help on using the changeset viewer.