diff options
author | Rob Norris <[email protected]> | 2024-05-28 11:56:41 -0400 |
---|---|---|
committer | Tony Hutter <[email protected]> | 2024-07-16 15:33:46 -0700 |
commit | 3ea3649755d4a684a7e04a0c6a5eb3df8f87b27b (patch) | |
tree | aa6fe633ebb7b1b964f0e6e7fe5beb34dd1f8d9b /module/os/linux | |
parent | 0342c4a6b22d872beb286a09004706f521061c24 (diff) |
Linux 6.10: work harder to avoid kmem_cache_alloc reuse
Linux 6.10 change kmem_cache_alloc to be a macro, rather than a
function, such that the old #undef for it in spl-kmem-cache.c would
remove its definition completely, breaking the build.
This inverts the model used before. Rather than always defining the
kmem_cache_* macro, then undefining then inside spl-kmem-cache.c,
instead we make a special tag to indicate we're currently inside
spl-kmem-cache.c, and not defining those in macros in the first place,
so we can use the kernel-supplied kmem_cache_* functions to implement
spl_kmem_cache_*, as we expect.
For all other callers, we create the macros as normal and remove access
to the kernel's own conflicting names.
Signed-off-by: Rob Norris <[email protected]>
Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Tony Hutter <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'module/os/linux')
-rw-r--r-- | module/os/linux/spl/spl-kmem-cache.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/module/os/linux/spl/spl-kmem-cache.c b/module/os/linux/spl/spl-kmem-cache.c index 42821ad60..737c2e063 100644 --- a/module/os/linux/spl/spl-kmem-cache.c +++ b/module/os/linux/spl/spl-kmem-cache.c @@ -21,6 +21,8 @@ * with the SPL. If not, see <http://www.gnu.org/licenses/>. */ +#define SPL_KMEM_CACHE_IMPLEMENTING + #include <linux/percpu_compat.h> #include <sys/kmem.h> #include <sys/kmem_cache.h> @@ -34,16 +36,6 @@ #include <linux/prefetch.h> /* - * Within the scope of spl-kmem.c file the kmem_cache_* definitions - * are removed to allow access to the real Linux slab allocator. - */ -#undef kmem_cache_destroy -#undef kmem_cache_create -#undef kmem_cache_alloc -#undef kmem_cache_free - - -/* * Linux 3.16 replaced smp_mb__{before,after}_{atomic,clear}_{dec,inc,bit}() * with smp_mb__{before,after}_atomic() because they were redundant. This is * only used inside our SLAB allocator, so we implement an internal wrapper |