hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/include/linux/slab_def.h
....@@ -2,6 +2,7 @@
22 #ifndef _LINUX_SLAB_DEF_H
33 #define _LINUX_SLAB_DEF_H
44
5
+#include <linux/kfence.h>
56 #include <linux/reciprocal_div.h>
67
78 /*
....@@ -61,9 +62,6 @@
6162 atomic_t allocmiss;
6263 atomic_t freehit;
6364 atomic_t freemiss;
64
-#ifdef CONFIG_DEBUG_SLAB_LEAK
65
- atomic_t store_user_clean;
66
-#endif
6765
6866 /*
6967 * If debugging is enabled, then the allocator can add additional
....@@ -75,9 +73,6 @@
7573 int obj_offset;
7674 #endif /* CONFIG_DEBUG_SLAB */
7775
78
-#ifdef CONFIG_MEMCG
79
- struct memcg_cache_params memcg_params;
80
-#endif
8176 #ifdef CONFIG_KASAN
8277 struct kasan_cache kasan_info;
8378 #endif
....@@ -117,4 +112,12 @@
117112 return reciprocal_divide(offset, cache->reciprocal_buffer_size);
118113 }
119114
115
+static inline int objs_per_slab_page(const struct kmem_cache *cache,
116
+ const struct page *page)
117
+{
118
+ if (is_kfence_address(page_address(page)))
119
+ return 1;
120
+ return cache->num;
121
+}
122
+
120123 #endif /* _LINUX_SLAB_DEF_H */