Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/subr_counter.c
Show All 37 Lines | |||||
#include <sys/sched.h> | #include <sys/sched.h> | ||||
#include <sys/smp.h> | #include <sys/smp.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <vm/uma.h> | #include <vm/uma.h> | ||||
#define IN_SUBR_COUNTER_C | #define IN_SUBR_COUNTER_C | ||||
#include <sys/counter.h> | #include <sys/counter.h> | ||||
static void | |||||
counter_u64_zero_sync(counter_u64_t c) | |||||
{ | |||||
int cpu; | |||||
CPU_FOREACH(cpu) | |||||
*(uint64_t*)zpcpu_get_cpu(c, cpu) = 0; | |||||
} | |||||
void | void | ||||
counter_u64_zero(counter_u64_t c) | counter_u64_zero(counter_u64_t c) | ||||
{ | { | ||||
counter_u64_zero_inline(c); | counter_u64_zero_inline(c); | ||||
} | } | ||||
uint64_t | uint64_t | ||||
counter_u64_fetch(counter_u64_t c) | counter_u64_fetch(counter_u64_t c) | ||||
{ | { | ||||
return (counter_u64_fetch_inline(c)); | return (counter_u64_fetch_inline(c)); | ||||
} | } | ||||
counter_u64_t | counter_u64_t | ||||
counter_u64_alloc(int flags) | counter_u64_alloc(int flags) | ||||
{ | { | ||||
counter_u64_t r; | |||||
r = uma_zalloc_pcpu(pcpu_zone_64, flags); | return (uma_zalloc_pcpu(pcpu_zone_64, flags | M_ZERO)); | ||||
if (r != NULL) | |||||
counter_u64_zero_sync(r); | |||||
return (r); | |||||
} | } | ||||
void | void | ||||
counter_u64_free(counter_u64_t c) | counter_u64_free(counter_u64_t c) | ||||
{ | { | ||||
uma_zfree_pcpu(pcpu_zone_64, c); | uma_zfree_pcpu(pcpu_zone_64, c); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 102 Lines • Show Last 20 Lines |