MCPcopy Create free account
hub / github.com/F-Stack/f-stack / counter_u64_fetch_inline

Function counter_u64_fetch_inline

freebsd/i386/include/counter.h:105–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105static inline uint64_t
106counter_u64_fetch_inline(uint64_t *p)
107{
108 struct counter_u64_fetch_cx8_arg arg;
109 uint64_t res;
110 int i;
111
112 res = 0;
113 if ((cpu_feature & CPUID_CX8) == 0) {
114 /*
115 * The machines without cmpxchg8b are not SMP.
116 * Disabling the preemption provides atomicity of the
117 * counter reading, since update is done in the
118 * critical section as well.
119 */
120 critical_enter();
121 CPU_FOREACH(i) {
122 res += *(uint64_t *)((char *)p +
123 UMA_PCPU_ALLOC_SIZE * i);
124 }
125 critical_exit();
126 } else {
127 arg.p = p;
128 arg.res = 0;
129 smp_rendezvous(NULL, counter_u64_fetch_cx8_one, NULL, &arg);
130 res = arg.res;
131 }
132 return (res);
133}
134
135static inline void
136counter_u64_zero_one_8b(uint64_t *p)

Callers

nothing calls this directly

Calls 3

smp_rendezvousFunction · 0.85
critical_enterFunction · 0.50
critical_exitFunction · 0.50

Tested by

no test coverage detected