slab.h (c1144d29f405ce1f4e6ede6482beb3d0d09750c6) slab.h (84c07d11aa619c6d24c682f469b10f344f0c02aa)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef MM_SLAB_H
3#define MM_SLAB_H
4/*
5 * Internal slab definitions
6 */
7
8#ifdef CONFIG_SLOB

--- 189 unchanged lines hidden (view full) ---

198 * Generic implementation of bulk operations
199 * These are useful for situations in which the allocator cannot
200 * perform optimizations. In that case segments of the object listed
201 * may be allocated or freed using these operations.
202 */
203void __kmem_cache_free_bulk(struct kmem_cache *, size_t, void **);
204int __kmem_cache_alloc_bulk(struct kmem_cache *, gfp_t, size_t, void **);
205
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef MM_SLAB_H
3#define MM_SLAB_H
4/*
5 * Internal slab definitions
6 */
7
8#ifdef CONFIG_SLOB

--- 189 unchanged lines hidden (view full) ---

198 * Generic implementation of bulk operations
199 * These are useful for situations in which the allocator cannot
200 * perform optimizations. In that case segments of the object listed
201 * may be allocated or freed using these operations.
202 */
203void __kmem_cache_free_bulk(struct kmem_cache *, size_t, void **);
204int __kmem_cache_alloc_bulk(struct kmem_cache *, gfp_t, size_t, void **);
205
206#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB)
206#ifdef CONFIG_MEMCG_KMEM
207
208/* List of all root caches. */
209extern struct list_head slab_root_caches;
210#define root_caches_node memcg_params.__root_caches_node
211
212/*
213 * Iterate over all memcg caches of the given root cache. The caller must hold
214 * slab_mutex.

--- 76 unchanged lines hidden (view full) ---

291 memcg_kmem_uncharge(page, order);
292}
293
294extern void slab_init_memcg_params(struct kmem_cache *);
295extern void memcg_link_cache(struct kmem_cache *s);
296extern void slab_deactivate_memcg_cache_rcu_sched(struct kmem_cache *s,
297 void (*deact_fn)(struct kmem_cache *));
298
207
208/* List of all root caches. */
209extern struct list_head slab_root_caches;
210#define root_caches_node memcg_params.__root_caches_node
211
212/*
213 * Iterate over all memcg caches of the given root cache. The caller must hold
214 * slab_mutex.

--- 76 unchanged lines hidden (view full) ---

291 memcg_kmem_uncharge(page, order);
292}
293
294extern void slab_init_memcg_params(struct kmem_cache *);
295extern void memcg_link_cache(struct kmem_cache *s);
296extern void slab_deactivate_memcg_cache_rcu_sched(struct kmem_cache *s,
297 void (*deact_fn)(struct kmem_cache *));
298
299#else /* CONFIG_MEMCG && !CONFIG_SLOB */
299#else /* CONFIG_MEMCG_KMEM */
300
301/* If !memcg, all caches are root. */
302#define slab_root_caches slab_caches
303#define root_caches_node list
304
305#define for_each_memcg_cache(iter, root) \
306 for ((void)(iter), (void)(root); 0; )
307

--- 38 unchanged lines hidden (view full) ---

346static inline void slab_init_memcg_params(struct kmem_cache *s)
347{
348}
349
350static inline void memcg_link_cache(struct kmem_cache *s)
351{
352}
353
300
301/* If !memcg, all caches are root. */
302#define slab_root_caches slab_caches
303#define root_caches_node list
304
305#define for_each_memcg_cache(iter, root) \
306 for ((void)(iter), (void)(root); 0; )
307

--- 38 unchanged lines hidden (view full) ---

346static inline void slab_init_memcg_params(struct kmem_cache *s)
347{
348}
349
350static inline void memcg_link_cache(struct kmem_cache *s)
351{
352}
353
354#endif /* CONFIG_MEMCG && !CONFIG_SLOB */
354#endif /* CONFIG_MEMCG_KMEM */
355
356static inline struct kmem_cache *cache_from_obj(struct kmem_cache *s, void *x)
357{
358 struct kmem_cache *cachep;
359 struct page *page;
360
361 /*
362 * When kmemcg is not being used, both assignments should return the

--- 169 unchanged lines hidden ---
355
356static inline struct kmem_cache *cache_from_obj(struct kmem_cache *s, void *x)
357{
358 struct kmem_cache *cachep;
359 struct page *page;
360
361 /*
362 * When kmemcg is not being used, both assignments should return the

--- 169 unchanged lines hidden ---