compiler.h | compiler.h | |||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
* | * | |||
* Permission is hereby granted to use or copy this program | * Permission is hereby granted to use or copy this program | |||
* for any purpose, provided the above notices are retained on all copies. | * for any purpose, provided the above notices are retained on all copies. | |||
* Permission to modify the code and to distribute modified code is granted , | * Permission to modify the code and to distribute modified code is granted , | |||
* provided the above notices are retained, and a notice that the code was | * provided the above notices are retained, and a notice that the code was | |||
* modified is included with the above copyright notice. | * modified is included with the above copyright notice. | |||
*/ | */ | |||
#include <stddef.h> /* for offsetof */ | #include <stddef.h> /* for offsetof */ | |||
#define likely(x) __builtin_expect(!!(x), 1) | #define caa_likely(x) __builtin_expect(!!(x), 1) | |||
#define unlikely(x) __builtin_expect(!!(x), 0) | #define caa_unlikely(x) __builtin_expect(!!(x), 0) | |||
#define cmm_barrier() asm volatile("" : : : "memory") | #define cmm_barrier() asm volatile("" : : : "memory") | |||
/* | /* | |||
* Instruct the compiler to perform only a single access to a variable | * Instruct the compiler to perform only a single access to a variable | |||
* (prohibits merging and refetching). The compiler is also forbidden to re order | * (prohibits merging and refetching). The compiler is also forbidden to re order | |||
* successive instances of CMM_ACCESS_ONCE(), but only when the compiler is aware of | * successive instances of CMM_ACCESS_ONCE(), but only when the compiler is aware of | |||
* particular ordering. Compiler ordering can be ensured, for example, by | * particular ordering. Compiler ordering can be ensured, for example, by | |||
* putting two CMM_ACCESS_ONCE() in separate C statements. | * putting two CMM_ACCESS_ONCE() in separate C statements. | |||
* | * | |||
End of changes. 1 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
uatomic.h | uatomic.h | |||
---|---|---|---|---|
skipping to change at line 507 | skipping to change at line 507 | |||
return; | return; | |||
} | } | |||
#define _uatomic_dec(addr) (__uatomic_dec((addr), sizeof(*(addr)))) | #define _uatomic_dec(addr) (__uatomic_dec((addr), sizeof(*(addr)))) | |||
#if ((CAA_BITS_PER_LONG != 64) && defined(CONFIG_RCU_COMPAT_ARCH)) | #if ((CAA_BITS_PER_LONG != 64) && defined(CONFIG_RCU_COMPAT_ARCH)) | |||
extern int __rcu_cas_avail; | extern int __rcu_cas_avail; | |||
extern int __rcu_cas_init(void); | extern int __rcu_cas_init(void); | |||
#define UATOMIC_COMPAT(insn) \ | #define UATOMIC_COMPAT(insn) \ | |||
((likely(__rcu_cas_avail > 0)) \ | ((caa_likely(__rcu_cas_avail > 0)) \ | |||
? (_uatomic_##insn) \ | ? (_uatomic_##insn) \ | |||
: ((unlikely(__rcu_cas_avail < 0) \ | : ((caa_unlikely(__rcu_cas_avail < 0) \ | |||
? ((__rcu_cas_init() > 0) \ | ? ((__rcu_cas_init() > 0) \ | |||
? (_uatomic_##insn) \ | ? (_uatomic_##insn) \ | |||
: (compat_uatomic_##insn)) \ | : (compat_uatomic_##insn)) \ | |||
: (compat_uatomic_##insn)))) | : (compat_uatomic_##insn)))) | |||
extern unsigned long _compat_uatomic_set(void *addr, | extern unsigned long _compat_uatomic_set(void *addr, | |||
unsigned long _new, int len); | unsigned long _new, int len); | |||
#define compat_uatomic_set(addr, _new) \ | #define compat_uatomic_set(addr, _new) \ | |||
((__typeof__(*(addr))) _compat_uatomic_set((addr), \ | ((__typeof__(*(addr))) _compat_uatomic_set((addr), \ | |||
(unsigned long)(_new), \ | (unsigned long)(_new), \ | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
urcu-call-rcu.h | urcu-call-rcu.h | |||
---|---|---|---|---|
skipping to change at line 64 | skipping to change at line 64 | |||
* via call_rcu(). | * via call_rcu(). | |||
*/ | */ | |||
struct rcu_head { | struct rcu_head { | |||
struct cds_wfq_node next; | struct cds_wfq_node next; | |||
void (*func)(struct rcu_head *head); | void (*func)(struct rcu_head *head); | |||
}; | }; | |||
/* | /* | |||
* Exported functions | * Exported functions | |||
* | ||||
* Important: see userspace RCU API.txt for call_rcu family of functions | ||||
* usage detail, including the surrounding RCU usage required when using | ||||
* these primitives. | ||||
*/ | */ | |||
/* | void call_rcu(struct rcu_head *head, | |||
* get_cpu_call_rcu_data should be called with RCU read-side lock held. | void (*func)(struct rcu_head *head)); | |||
* Callers should be registered RCU read-side threads. | ||||
*/ | ||||
struct call_rcu_data *get_cpu_call_rcu_data(int cpu); | ||||
pthread_t get_call_rcu_thread(struct call_rcu_data *crdp); | ||||
struct call_rcu_data *create_call_rcu_data(unsigned long flags, | struct call_rcu_data *create_call_rcu_data(unsigned long flags, | |||
int cpu_affinity); | int cpu_affinity); | |||
int set_cpu_call_rcu_data(int cpu, struct call_rcu_data *crdp); | void call_rcu_data_free(struct call_rcu_data *crdp); | |||
struct call_rcu_data *get_default_call_rcu_data(void); | struct call_rcu_data *get_default_call_rcu_data(void); | |||
/* | struct call_rcu_data *get_cpu_call_rcu_data(int cpu); | |||
* get_call_rcu_data should be called from registered RCU read-side | ||||
* threads. For the QSBR flavor, the caller should be online. | ||||
*/ | ||||
struct call_rcu_data *get_call_rcu_data(void); | ||||
struct call_rcu_data *get_thread_call_rcu_data(void); | struct call_rcu_data *get_thread_call_rcu_data(void); | |||
struct call_rcu_data *get_call_rcu_data(void); | ||||
pthread_t get_call_rcu_thread(struct call_rcu_data *crdp); | ||||
void set_thread_call_rcu_data(struct call_rcu_data *crdp); | void set_thread_call_rcu_data(struct call_rcu_data *crdp); | |||
int set_cpu_call_rcu_data(int cpu, struct call_rcu_data *crdp); | ||||
int create_all_cpu_call_rcu_data(unsigned long flags); | int create_all_cpu_call_rcu_data(unsigned long flags); | |||
/* | ||||
* call_rcu should be called from registered RCU read-side threads. | ||||
* For the QSBR flavor, the caller should be online. | ||||
*/ | ||||
void call_rcu(struct rcu_head *head, | ||||
void (*func)(struct rcu_head *head)); | ||||
void call_rcu_data_free(struct call_rcu_data *crdp); | ||||
void free_all_cpu_call_rcu_data(void); | void free_all_cpu_call_rcu_data(void); | |||
void call_rcu_after_fork_child(void); | void call_rcu_after_fork_child(void); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif /* _URCU_CALL_RCU_H */ | #endif /* _URCU_CALL_RCU_H */ | |||
End of changes. 8 change blocks. | ||||
19 lines changed or deleted | 16 lines changed or added | |||
urcu-pointer.h | urcu-pointer.h | |||
---|---|---|---|---|
skipping to change at line 104 | skipping to change at line 104 | |||
(_________p1); \ | (_________p1); \ | |||
}) | }) | |||
extern void *rcu_set_pointer_sym(void **p, void *v); | extern void *rcu_set_pointer_sym(void **p, void *v); | |||
#define rcu_set_pointer(p, v) \ | #define rcu_set_pointer(p, v) \ | |||
({ \ | ({ \ | |||
typeof(*(p)) _________pv = (v); \ | typeof(*(p)) _________pv = (v); \ | |||
typeof(*(p)) _________p1 = URCU_FORCE_CAST(typeof(*(p)), \ | typeof(*(p)) _________p1 = URCU_FORCE_CAST(typeof(*(p)), \ | |||
rcu_set_pointer_sym(URCU_FORCE_CAST(void **, p), \ | rcu_set_pointer_sym(URCU_FORCE_CAST(void **, p), \ | |||
_________pv)); \ | _________pv)); \ | |||
(_________p1); \ | ||||
}) | }) | |||
#endif /* !_LGPL_SOURCE */ | #endif /* !_LGPL_SOURCE */ | |||
/* | /* | |||
* rcu_assign_pointer(type *ptr, type *new) | * rcu_assign_pointer(type *ptr, type *new) | |||
* | * | |||
* Same as rcu_set_pointer, but takes the pointer to assign to rather than its | * Same as rcu_set_pointer, but takes the pointer to assign to rather than its | |||
* address as first parameter. Provided for compatibility with the Linux ke rnel | * address as first parameter. Provided for compatibility with the Linux ke rnel | |||
* RCU semantic. | * RCU semantic. | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 1 lines changed or added | |||