diff options
Diffstat (limited to 'include/linux/slub_def.h')
| -rw-r--r-- | include/linux/slub_def.h | 19 | 
1 files changed, 15 insertions, 4 deletions
| diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index d1faa019c02a..75f56c2ef2d4 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h @@ -99,6 +99,15 @@ struct kmem_cache {  	 */  	int remote_node_defrag_ratio;  #endif + +#ifdef CONFIG_SLAB_FREELIST_RANDOM +	unsigned int *random_seq; +#endif + +#ifdef CONFIG_KASAN +	struct kasan_cache kasan_info; +#endif +  	struct kmem_cache_node *node[MAX_NUMNODES];  }; @@ -114,15 +123,17 @@ static inline void sysfs_slab_remove(struct kmem_cache *s)  void object_err(struct kmem_cache *s, struct page *page,  		u8 *object, char *reason); +void *fixup_red_left(struct kmem_cache *s, void *p); +  static inline void *nearest_obj(struct kmem_cache *cache, struct page *page,  				void *x) {  	void *object = x - (x - page_address(page)) % cache->size;  	void *last_object = page_address(page) +  		(page->objects - 1) * cache->size; -	if (unlikely(object > last_object)) -		return last_object; -	else -		return object; +	void *result = (unlikely(object > last_object)) ? last_object : object; + +	result = fixup_red_left(cache, result); +	return result;  }  #endif /* _LINUX_SLUB_DEF_H */ |