Per-CPU Reference Counter
include/sync/percpu_rc.h View source View on GitHubStructs
Section titled “Structs”percpu_rc
Section titled “percpu_rc”struct percpu_rc {
_Atomic int64_t count;
_Atomic uintptr_t percpu_count_ptr;
percpu_rc_release_fn release;
bool allow_reinit;
struct rcu_cb rcu;
}; percpu_rc_flags
Section titled “percpu_rc_flags”enum percpu_rc_flags {
PERCPU_RC_INIT_ATOMIC = 1 << 0,
PERCPU_RC_ALLOW_REINIT = 1 << 1,
}; Type Aliases
Section titled “Type Aliases”percpu_rc_release_fn
Section titled “percpu_rc_release_fn”typedef void (*percpu_rc_release_fn)(struct percpu_rc * *); Functions
Section titled “Functions”percpu_rc_init
Section titled “percpu_rc_init”int percpu_rc_init(struct percpu_rc *ref, percpu_rc_release_fn release, enum percpu_rc_flags flags); percpu_rc_destroy
Section titled “percpu_rc_destroy”void percpu_rc_destroy(struct percpu_rc *ref); percpu_rc_kill
Section titled “percpu_rc_kill”void percpu_rc_kill(struct percpu_rc *ref); percpu_rc_reinit
Section titled “percpu_rc_reinit”void percpu_rc_reinit(struct percpu_rc *ref); percpu_rc_resurrect
Section titled “percpu_rc_resurrect”void percpu_rc_resurrect(struct percpu_rc *ref); percpu_rc_read
Section titled “percpu_rc_read”int64_t percpu_rc_read(struct percpu_rc *ref); percpu_rc_is_percpu
Section titled “percpu_rc_is_percpu”bool percpu_rc_is_percpu(uintptr_t pcpu); percpu_rc_get
Section titled “percpu_rc_get”void percpu_rc_get(struct percpu_rc *ref); percpu_rc_put
Section titled “percpu_rc_put”void percpu_rc_put(struct percpu_rc *ref); percpu_rc_tryget
Section titled “percpu_rc_tryget”bool percpu_rc_tryget(struct percpu_rc *ref); percpu_rc_tryget_live
Section titled “percpu_rc_tryget_live”bool percpu_rc_tryget_live(struct percpu_rc *ref); percpu_rc_is_zero
Section titled “percpu_rc_is_zero”bool percpu_rc_is_zero(struct percpu_rc *ref); percpu_rc_is_dying
Section titled “percpu_rc_is_dying”bool percpu_rc_is_dying(struct percpu_rc *ref); Macros
Section titled “Macros”PERCPU_COUNT_BIAS
Section titled “PERCPU_COUNT_BIAS”#define PERCPU_COUNT_BIAS (1LL << 30) PERCPU_RC_DEAD
Section titled “PERCPU_RC_DEAD”#define PERCPU_RC_DEAD (1UL << 0) PERCPU_RC_ATOMIC
Section titled “PERCPU_RC_ATOMIC”#define PERCPU_RC_ATOMIC (1UL << 1) PERCPU_RC_PTR_MASK
Section titled “PERCPU_RC_PTR_MASK”#define PERCPU_RC_PTR_MASK (~(PERCPU_RC_DEAD | PERCPU_RC_ATOMIC)) PERCPU_RC_PTR
Section titled “PERCPU_RC_PTR”#define PERCPU_RC_PTR(m) (int64_t *) (m & PERCPU_RC_PTR_MASK)