Lines Matching refs:slab

16  * Internal slab definitions
52 struct slab {
62 struct slab *next;
96 static_assert(offsetof(struct page, pg) == offsetof(struct slab, sl))
104 static_assert(sizeof(struct slab) <= sizeof(struct page));
106 static_assert(IS_ALIGNED(offsetof(struct slab, freelist), sizeof(freelist_aba_t)));
110 * folio_slab - Converts from folio to slab.
113 * Currently struct slab is a different representation of a folio where
116 * Return: The slab which contains this folio.
119 const struct folio *: (const struct slab *)(folio), \
120 struct folio *: (struct slab *)(folio)))
123 * slab_folio - The folio allocated for a slab
124 * @slab: The slab.
128 * now accessed by struct slab. It is occasionally necessary to convert back to
134 const struct slab *: (const struct folio *)s, \
135 struct slab *: (struct folio *)s))
138 * page_slab - Converts from first struct page to slab.
139 * @p: The first (either head of compound or single) page of slab.
141 * A temporary wrapper to convert struct page to struct slab in situations where
144 * Long-term ideally everything would work with struct slab directly or go
145 * through folio to struct slab.
147 * Return: The slab which contains this page
150 const struct page *: (const struct slab *)(p), \
151 struct page *: (struct slab *)(p)))
154 * slab_page - The first struct page allocated for a slab
155 * @slab: The slab.
157 * A convenience wrapper for converting slab to the first struct page of the
159 * struct slab.
167 static inline bool slab_test_pfmemalloc(const struct slab *slab)
169 return folio_test_active((struct folio *)slab_folio(slab));
172 static inline void slab_set_pfmemalloc(struct slab *slab)
174 folio_set_active(slab_folio(slab));
177 static inline void slab_clear_pfmemalloc(struct slab *slab)
179 folio_clear_active(slab_folio(slab));
182 static inline void __slab_clear_pfmemalloc(struct slab *slab)
184 __folio_clear_active(slab_folio(slab));
187 static inline void *slab_address(const struct slab *slab)
189 return folio_address(slab_folio(slab));
192 static inline int slab_nid(const struct slab *slab)
194 return folio_nid(slab_folio(slab));
197 static inline pg_data_t *slab_pgdat(const struct slab *slab)
199 return folio_pgdat(slab_folio(slab));
202 static inline struct slab *virt_to_slab(const void *addr)
212 static inline int slab_order(const struct slab *slab)
214 return folio_order((struct folio *)slab_folio(slab));
217 static inline size_t slab_size(const struct slab *slab)
219 return PAGE_SIZE << slab_order(slab);
241 * contains both the order and the number of objects that a slab of the
273 int refcount; /* Refcount for slab cache destroy */
279 struct list_head list; /* List of slab caches */
322 const struct slab *slab, void *x)
324 void *object = x - (x - slab_address(slab)) % cache->size;
325 void *last_object = slab_address(slab) +
326 (slab->objects - 1) * cache->size;
342 const struct slab *slab, void *obj)
346 return __obj_to_index(cache, slab_address(slab), obj);
350 const struct slab *slab)
352 return slab->objects;
356 * State of the slab allocator.
360 * have the problem that the structures used for managing slab caches are
361 * allocated from slab caches themselves.
364 DOWN, /* No slab functionality yet */
372 /* The slab cache mutex protects the management structures during changes */
375 /* The list of all slab caches on the system */
378 /* The slab cache that manages slab cache information */
420 /* Functions provided by the slab allocators */
541 * slab_objcgs - get the object cgroups vector associated with a slab
542 * @slab: a pointer to the slab struct
544 * Returns a pointer to the object cgroups vector associated with the slab,
547 static inline struct obj_cgroup **slab_objcgs(struct slab *slab)
549 unsigned long memcg_data = READ_ONCE(slab->memcg_data);
552 slab_page(slab));
553 VM_BUG_ON_PAGE(memcg_data & MEMCG_DATA_KMEM, slab_page(slab));
558 int memcg_alloc_slab_cgroups(struct slab *slab, struct kmem_cache *s,
563 static inline struct obj_cgroup **slab_objcgs(struct slab *slab)
568 static inline int memcg_alloc_slab_cgroups(struct slab *slab,
658 struct slab *kp_slab;
666 void __kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct slab *slab);
670 const struct slab *slab, bool to_user);