svn commit: r357672 - head/sys/sys
Mateusz Guzik
mjg at FreeBSD.org
Fri Feb 7 22:43:59 UTC 2020
Author: mjg
Date: Fri Feb 7 22:43:58 2020
New Revision: 357672
URL: https://svnweb.freebsd.org/changeset/base/357672
Log:
Add zpcpu_{set,add,sub}_protected.
The _protected suffix follows counter(9).
Modified:
head/sys/sys/pcpu.h
Modified: head/sys/sys/pcpu.h
==============================================================================
--- head/sys/sys/pcpu.h Fri Feb 7 22:36:37 2020 (r357671)
+++ head/sys/sys/pcpu.h Fri Feb 7 22:43:58 2020 (r357672)
@@ -256,6 +256,24 @@ extern struct pcpu *cpuid_to_pcpu[];
_old; \
})
+#define zpcpu_set_protected(base, val) ({ \
+ MPASS(curthread->td_critnest > 0); \
+ __typeof(val) *_ptr = zpcpu_get(base); \
+ *_ptr = (val); \
+})
+
+#define zpcpu_add_protected(base, val) ({ \
+ MPASS(curthread->td_critnest > 0); \
+ __typeof(val) *_ptr = zpcpu_get(base); \
+ *_ptr += (val); \
+})
+
+#define zpcpu_sub_protected(base, val) ({ \
+ MPASS(curthread->td_critnest > 0); \
+ __typeof(val) *_ptr = zpcpu_get(base); \
+ *_ptr -= (val); \
+})
+
/*
* Machine dependent callouts. cpu_pcpu_init() is responsible for
* initializing machine dependent fields of struct pcpu, and
More information about the svn-src-all
mailing list