summaryrefslogtreecommitdiff
path: root/lib/bitops.h
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2020-07-22 00:09:15 +0200
committerMaria Matejka <mq@ucw.cz>2021-03-25 16:47:48 +0100
commit886dd92eeefa070d8db6aaf0245a67f7a9e9b983 (patch)
tree67911e19951d083c003e212578fae76d93deb01c /lib/bitops.h
parent82f19ba95e421f00a8e99a866a2b8d9bbdba6cdc (diff)
Slab: head now uses bitmask for used/free nodes info instead of lists
From now, there are no auxiliary pointers stored in the free slab nodes. This led to strange debugging problems if use-after-free happened in slab-allocated structures, especially if the structure's first member is a next pointer. This also reduces the memory needed by 1 pointer per allocated object. OTOH, we now rely on pages being aligned to their size's multiple, which is quite common anyway.
Diffstat (limited to 'lib/bitops.h')
-rw-r--r--lib/bitops.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/bitops.h b/lib/bitops.h
index a4c48a10..0beda2a3 100644
--- a/lib/bitops.h
+++ b/lib/bitops.h
@@ -28,6 +28,7 @@ u32 u32_log2(u32 v);
static inline u32 u32_hash(u32 v) { return v * 2902958171u; }
static inline u8 u32_popcount(u32 v) { return __builtin_popcount(v); }
+static inline u8 u64_popcount(u64 v) { return __builtin_popcountll(v); }
static inline int u32_clz(u32 v) { return __builtin_clz(v); }
static inline int u32_ctz(u32 v) { return __builtin_ctz(v); }