~martin-decky/helenos/rcu

« back to all changes in this revision

Viewing changes to kernel/generic/include/synch/rcu.h

  • Committer: Martin Decky
  • Date: 2012-06-20 18:07:24 UTC
  • Revision ID: martin@decky.cz-20120620180724-vhctn1c30vh1qayh
adopt RCU for HelenOS specifics (no CPUs in motion)

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
#define RCU_VOLATILE(type, lvalue) \
58
58
        (*((type volatile *) &(lvalue)))
59
59
 
 
60
 
 
61
// FIXME: Shouldn't this be atomic_count_t?
60
62
typedef uint32_t gp_t;
61
63
 
62
64
/* Forward declaration */
70
72
} rcu_cb_type_t;
71
73
 
72
74
typedef struct rcu {
73
 
        struct rcu *next;    /* Next in the chain of callbacks */
74
 
        rcu_cb_t func;       /* Callback function to invoke */
75
 
        rcu_cb_type_t type;  /* Callback type (default/exclusive) */
76
 
        atomic_t weight;     /* Callback importance estimate */
 
75
        link_t link;
 
76
        
 
77
        rcu_cb_t func;          /* Callback function to invoke */
 
78
        rcu_cb_type_t type;     /* Callback type (default/exclusive) */
 
79
        atomic_count_t weight;  /* Callback importance estimate */
77
80
} rcu_t;
78
81
 
79
82
typedef struct {
80
83
        mutex_t lock;              /* Reclaimer exclusivity */
81
84
        struct thread *reclaimer;  /* Reclaimer thread */
82
 
        struct cpu *relay_cpu;     /* Used when CPU in motion */
83
85
        
84
86
        /*
85
 
         * Fields used by readers, writers and per CPU reclaimer threads.
 
87
         * Fields used by readers, writers and per-CPU reclaimer threads.
86
88
         */
87
89
        semaphore_t queue_sema;  /* Wakes up the reclaimer */
88
 
        rcu_t *nextlist;         /* Callbacks waiting for the next GP */
89
 
        rcu_t **nexttail;        /* Next GP list tail reference */
90
 
        rcu_t *curlist;          /* Callbacks waiting for this GP */
91
 
        rcu_t **curtail;         /* Current GP list tail reference */
92
 
        atomic_t weight;         /* Current weight of the whole queue */
93
 
        uint32_t nesting;        /* Nesting level of read locks */
94
 
        gp_t gp_ctr;             /* Local (observed) GP counter */
95
 
        atomic_t *sync;          /* Request to synchronize callbacks */
 
90
        list_t curlist;          /* Callbacks waiting for this GP */
 
91
        list_t nextlist;         /* Callbacks waiting for the next GP */
 
92
        
 
93
        atomic_t weight;   /* Current weight of the whole queue */
 
94
        uint32_t nesting;  /* Nesting level of read locks */
 
95
        gp_t gp_ctr;       /* Local (observed) GP counter */
 
96
        atomic_t *sync;    /* Request to synchronize callbacks */
96
97
        
97
98
        /*
98
99
         * Fields used by the detector thread.
134
135
extern void rcu_read_unlock(void);
135
136
extern void rcu_call(rcu_cb_t callb, rcu_t *, atomic_count_t);
136
137
extern void rcu_call_excl(rcu_cb_t, rcu_t *, atomic_count_t);
137
 
extern void rcu_call_high(rcu_cb_t, rcu_t *, atomic_count_t);
138
 
extern void rcu_call_excl_high(rcu_cb_t, rcu_t *, atomic_count_t);
139
138
extern void rcu_synchronize(void);
140
139
extern void rcu_synchronize_shared(uint32_t);
141
140
extern void rcu_call_synchronize(void);