Add a utility macro to simplify calculating an aggregate sum from a DPCPU
counter variable. Sponsored by: FreeBSD Foundation Reviewed by: jhb, rpaulo, rwatson (previous version of patch) MFC after: 1 week
This commit is contained in:
parent
4c3cf69727
commit
5ad333cf62
@ -106,6 +106,17 @@ extern uintptr_t dpcpu_off[];
|
||||
#define DPCPU_ID_GET(i, n) (*DPCPU_ID_PTR(i, n))
|
||||
#define DPCPU_ID_SET(i, n, v) (*DPCPU_ID_PTR(i, n) = v)
|
||||
|
||||
/*
|
||||
* Utility macros.
|
||||
*/
|
||||
#define DPCPU_SUM(n, var, sum) \
|
||||
do { \
|
||||
(sum) = 0; \
|
||||
u_int i; \
|
||||
CPU_FOREACH(i) \
|
||||
(sum) += (DPCPU_ID_PTR(i, n))->var; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* XXXUPS remove as soon as we have per cpu variable
|
||||
* linker sets and can define rm_queue in _rm_lock.h
|
||||
|
Loading…
x
Reference in New Issue
Block a user