When running in userspace, we currently don't have a real percpu
implementation available - at least in bcachefs-tools, which is where
this code is currently used in userspace.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
lockdep_init_map(&lock->dep_map, name, key, 0);
#endif
+ /*
+ * Don't assume that we have real percpu variables available in
+ * userspace:
+ */
+#ifdef __KERNEL__
if (flags & SIX_LOCK_INIT_PCPU) {
/*
* We don't return an error here on memory allocation failure
*/
lock->readers = alloc_percpu(unsigned);
}
+#endif
}
EXPORT_SYMBOL_GPL(__six_lock_init);