.. | .. |
---|
2 | 2 | #ifndef _LINUX_SLAB_DEF_H |
---|
3 | 3 | #define _LINUX_SLAB_DEF_H |
---|
4 | 4 | |
---|
| 5 | +#include <linux/kfence.h> |
---|
5 | 6 | #include <linux/reciprocal_div.h> |
---|
6 | 7 | |
---|
7 | 8 | /* |
---|
.. | .. |
---|
61 | 62 | atomic_t allocmiss; |
---|
62 | 63 | atomic_t freehit; |
---|
63 | 64 | atomic_t freemiss; |
---|
64 | | -#ifdef CONFIG_DEBUG_SLAB_LEAK |
---|
65 | | - atomic_t store_user_clean; |
---|
66 | | -#endif |
---|
67 | 65 | |
---|
68 | 66 | /* |
---|
69 | 67 | * If debugging is enabled, then the allocator can add additional |
---|
.. | .. |
---|
75 | 73 | int obj_offset; |
---|
76 | 74 | #endif /* CONFIG_DEBUG_SLAB */ |
---|
77 | 75 | |
---|
78 | | -#ifdef CONFIG_MEMCG |
---|
79 | | - struct memcg_cache_params memcg_params; |
---|
80 | | -#endif |
---|
81 | 76 | #ifdef CONFIG_KASAN |
---|
82 | 77 | struct kasan_cache kasan_info; |
---|
83 | 78 | #endif |
---|
.. | .. |
---|
117 | 112 | return reciprocal_divide(offset, cache->reciprocal_buffer_size); |
---|
118 | 113 | } |
---|
119 | 114 | |
---|
| 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 | + |
---|
120 | 123 | #endif /* _LINUX_SLAB_DEF_H */ |
---|