1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef MM_SLAB_H 3 #define MM_SLAB_H 4 5 #include <linux/reciprocal_div.h> 6 #include <linux/list_lru.h> 7 #include <linux/local_lock.h> 8 #include <linux/random.h> 9 #include <linux/kobject.h> 10 #include <linux/sched/mm.h> 11 #include <linux/memcontrol.h> 12 #include <linux/kfence.h> 13 #include <linux/kasan.h> 14 15 /* 16 * Internal slab definitions 17 */ 18 19 #ifdef CONFIG_64BIT 20 # ifdef system_has_cmpxchg128 21 # define system_has_freelist_aba() system_has_cmpxchg128() 22 # define try_cmpxchg_freelist try_cmpxchg128 23 # endif 24 #define this_cpu_try_cmpxchg_freelist this_cpu_try_cmpxchg128 25 typedef u128 freelist_full_t; 26 #else /* CONFIG_64BIT */ 27 # ifdef system_has_cmpxchg64 28 # define system_has_freelist_aba() system_has_cmpxchg64() 29 # define try_cmpxchg_freelist try_cmpxchg64 30 # endif 31 #define this_cpu_try_cmpxchg_freelist this_cpu_try_cmpxchg64 32 typedef u64 freelist_full_t; 33 #endif /* CONFIG_64BIT */ 34 35 #if defined(system_has_freelist_aba) && !defined(CONFIG_HAVE_ALIGNED_STRUCT_PAGE) 36 #undef system_has_freelist_aba 37 #endif 38 39 /* 40 * Freelist pointer and counter to cmpxchg together, avoids the typical ABA 41 * problems with cmpxchg of just a pointer. 42 */ 43 typedef union { 44 struct { 45 void *freelist; 46 unsigned long counter; 47 }; 48 freelist_full_t full; 49 } freelist_aba_t; 50 51 /* Reuses the bits in struct page */ 52 struct slab { 53 unsigned long __page_flags; 54 55 struct kmem_cache *slab_cache; 56 union { 57 struct { 58 union { 59 struct list_head slab_list; 60 #ifdef CONFIG_SLUB_CPU_PARTIAL 61 struct { 62 struct slab *next; 63 int slabs; /* Nr of slabs left */ 64 }; 65 #endif 66 }; 67 /* Double-word boundary */ 68 union { 69 struct { 70 void *freelist; /* first free object */ 71 union { 72 unsigned long counters; 73 struct { 74 unsigned inuse:16; 75 unsigned objects:15; 76 unsigned frozen:1; 77 }; 78 }; 79 }; 80 #ifdef system_has_freelist_aba 81 freelist_aba_t freelist_counter; 82 #endif 83 }; 84 }; 85 struct rcu_head rcu_head; 86 }; 87 88 unsigned int __page_type; 89 atomic_t __page_refcount; 90 #ifdef CONFIG_SLAB_OBJ_EXT 91 unsigned long obj_exts; 92 #endif 93 }; 94 95 #define SLAB_MATCH(pg, sl) \ 96 static_assert(offsetof(struct page, pg) == offsetof(struct slab, sl)) 97 SLAB_MATCH(flags, __page_flags); 98 SLAB_MATCH(compound_head, slab_cache); /* Ensure bit 0 is clear */ 99 SLAB_MATCH(_refcount, __page_refcount); 100 #ifdef CONFIG_MEMCG 101 SLAB_MATCH(memcg_data, obj_exts); 102 #elif defined(CONFIG_SLAB_OBJ_EXT) 103 SLAB_MATCH(_unused_slab_obj_exts, obj_exts); 104 #endif 105 #undef SLAB_MATCH 106 static_assert(sizeof(struct slab) <= sizeof(struct page)); 107 #if defined(system_has_freelist_aba) 108 static_assert(IS_ALIGNED(offsetof(struct slab, freelist), sizeof(freelist_aba_t))); 109 #endif 110 111 /** 112 * folio_slab - Converts from folio to slab. 113 * @folio: The folio. 114 * 115 * Currently struct slab is a different representation of a folio where 116 * folio_test_slab() is true. 117 * 118 * Return: The slab which contains this folio. 119 */ 120 #define folio_slab(folio) (_Generic((folio), \ 121 const struct folio *: (const struct slab *)(folio), \ 122 struct folio *: (struct slab *)(folio))) 123 124 /** 125 * slab_folio - The folio allocated for a slab 126 * @slab: The slab. 127 * 128 * Slabs are allocated as folios that contain the individual objects and are 129 * using some fields in the first struct page of the folio - those fields are 130 * now accessed by struct slab. It is occasionally necessary to convert back to 131 * a folio in order to communicate with the rest of the mm. Please use this 132 * helper function instead of casting yourself, as the implementation may change 133 * in the future. 134 */ 135 #define slab_folio(s) (_Generic((s), \ 136 const struct slab *: (const struct folio *)s, \ 137 struct slab *: (struct folio *)s)) 138 139 /** 140 * page_slab - Converts from first struct page to slab. 141 * @p: The first (either head of compound or single) page of slab. 142 * 143 * A temporary wrapper to convert struct page to struct slab in situations where 144 * we know the page is the compound head, or single order-0 page. 145 * 146 * Long-term ideally everything would work with struct slab directly or go 147 * through folio to struct slab. 148 * 149 * Return: The slab which contains this page 150 */ 151 #define page_slab(p) (_Generic((p), \ 152 const struct page *: (const struct slab *)(p), \ 153 struct page *: (struct slab *)(p))) 154 155 /** 156 * slab_page - The first struct page allocated for a slab 157 * @slab: The slab. 158 * 159 * A convenience wrapper for converting slab to the first struct page of the 160 * underlying folio, to communicate with code not yet converted to folio or 161 * struct slab. 162 */ 163 #define slab_page(s) folio_page(slab_folio(s), 0) 164 165 /* 166 * If network-based swap is enabled, sl*b must keep track of whether pages 167 * were allocated from pfmemalloc reserves. 168 */ 169 static inline bool slab_test_pfmemalloc(const struct slab *slab) 170 { 171 return folio_test_active(slab_folio(slab)); 172 } 173 174 static inline void slab_set_pfmemalloc(struct slab *slab) 175 { 176 folio_set_active(slab_folio(slab)); 177 } 178 179 static inline void slab_clear_pfmemalloc(struct slab *slab) 180 { 181 folio_clear_active(slab_folio(slab)); 182 } 183 184 static inline void __slab_clear_pfmemalloc(struct slab *slab) 185 { 186 __folio_clear_active(slab_folio(slab)); 187 } 188 189 static inline void *slab_address(const struct slab *slab) 190 { 191 return folio_address(slab_folio(slab)); 192 } 193 194 static inline int slab_nid(const struct slab *slab) 195 { 196 return folio_nid(slab_folio(slab)); 197 } 198 199 static inline pg_data_t *slab_pgdat(const struct slab *slab) 200 { 201 return folio_pgdat(slab_folio(slab)); 202 } 203 204 static inline struct slab *virt_to_slab(const void *addr) 205 { 206 struct folio *folio = virt_to_folio(addr); 207 208 if (!folio_test_slab(folio)) 209 return NULL; 210 211 return folio_slab(folio); 212 } 213 214 static inline int slab_order(const struct slab *slab) 215 { 216 return folio_order(slab_folio(slab)); 217 } 218 219 static inline size_t slab_size(const struct slab *slab) 220 { 221 return PAGE_SIZE << slab_order(slab); 222 } 223 224 #ifdef CONFIG_SLUB_CPU_PARTIAL 225 #define slub_percpu_partial(c) ((c)->partial) 226 227 #define slub_set_percpu_partial(c, p) \ 228 ({ \ 229 slub_percpu_partial(c) = (p)->next; \ 230 }) 231 232 #define slub_percpu_partial_read_once(c) READ_ONCE(slub_percpu_partial(c)) 233 #else 234 #define slub_percpu_partial(c) NULL 235 236 #define slub_set_percpu_partial(c, p) 237 238 #define slub_percpu_partial_read_once(c) NULL 239 #endif // CONFIG_SLUB_CPU_PARTIAL 240 241 /* 242 * Word size structure that can be atomically updated or read and that 243 * contains both the order and the number of objects that a slab of the 244 * given order would contain. 245 */ 246 struct kmem_cache_order_objects { 247 unsigned int x; 248 }; 249 250 /* 251 * Slab cache management. 252 */ 253 struct kmem_cache { 254 #ifndef CONFIG_SLUB_TINY 255 struct kmem_cache_cpu __percpu *cpu_slab; 256 #endif 257 /* Used for retrieving partial slabs, etc. */ 258 slab_flags_t flags; 259 unsigned long min_partial; 260 unsigned int size; /* Object size including metadata */ 261 unsigned int object_size; /* Object size without metadata */ 262 struct reciprocal_value reciprocal_size; 263 unsigned int offset; /* Free pointer offset */ 264 /* Specific free pointer requested (if not UINT_MAX) */ 265 unsigned int rcu_freeptr_offset; 266 #ifdef CONFIG_SLUB_CPU_PARTIAL 267 /* Number of per cpu partial objects to keep around */ 268 unsigned int cpu_partial; 269 /* Number of per cpu partial slabs to keep around */ 270 unsigned int cpu_partial_slabs; 271 #endif 272 struct kmem_cache_order_objects oo; 273 274 /* Allocation and freeing of slabs */ 275 struct kmem_cache_order_objects min; 276 gfp_t allocflags; /* gfp flags to use on each alloc */ 277 int refcount; /* Refcount for slab cache destroy */ 278 void (*ctor)(void *object); /* Object constructor */ 279 unsigned int inuse; /* Offset to metadata */ 280 unsigned int align; /* Alignment */ 281 unsigned int red_left_pad; /* Left redzone padding size */ 282 const char *name; /* Name (only for display!) */ 283 struct list_head list; /* List of slab caches */ 284 #ifdef CONFIG_SYSFS 285 struct kobject kobj; /* For sysfs */ 286 #endif 287 #ifdef CONFIG_SLAB_FREELIST_HARDENED 288 unsigned long random; 289 #endif 290 291 #ifdef CONFIG_NUMA 292 /* 293 * Defragmentation by allocating from a remote node. 294 */ 295 unsigned int remote_node_defrag_ratio; 296 #endif 297 298 #ifdef CONFIG_SLAB_FREELIST_RANDOM 299 unsigned int *random_seq; 300 #endif 301 302 #ifdef CONFIG_KASAN_GENERIC 303 struct kasan_cache kasan_info; 304 #endif 305 306 #ifdef CONFIG_HARDENED_USERCOPY 307 unsigned int useroffset; /* Usercopy region offset */ 308 unsigned int usersize; /* Usercopy region size */ 309 #endif 310 311 struct kmem_cache_node *node[MAX_NUMNODES]; 312 }; 313 314 #if defined(CONFIG_SYSFS) && !defined(CONFIG_SLUB_TINY) 315 #define SLAB_SUPPORTS_SYSFS 316 void sysfs_slab_unlink(struct kmem_cache *s); 317 void sysfs_slab_release(struct kmem_cache *s); 318 #else 319 static inline void sysfs_slab_unlink(struct kmem_cache *s) { } 320 static inline void sysfs_slab_release(struct kmem_cache *s) { } 321 #endif 322 323 void *fixup_red_left(struct kmem_cache *s, void *p); 324 325 static inline void *nearest_obj(struct kmem_cache *cache, 326 const struct slab *slab, void *x) 327 { 328 void *object = x - (x - slab_address(slab)) % cache->size; 329 void *last_object = slab_address(slab) + 330 (slab->objects - 1) * cache->size; 331 void *result = (unlikely(object > last_object)) ? last_object : object; 332 333 result = fixup_red_left(cache, result); 334 return result; 335 } 336 337 /* Determine object index from a given position */ 338 static inline unsigned int __obj_to_index(const struct kmem_cache *cache, 339 void *addr, void *obj) 340 { 341 return reciprocal_divide(kasan_reset_tag(obj) - addr, 342 cache->reciprocal_size); 343 } 344 345 static inline unsigned int obj_to_index(const struct kmem_cache *cache, 346 const struct slab *slab, void *obj) 347 { 348 if (is_kfence_address(obj)) 349 return 0; 350 return __obj_to_index(cache, slab_address(slab), obj); 351 } 352 353 static inline int objs_per_slab(const struct kmem_cache *cache, 354 const struct slab *slab) 355 { 356 return slab->objects; 357 } 358 359 /* 360 * State of the slab allocator. 361 * 362 * This is used to describe the states of the allocator during bootup. 363 * Allocators use this to gradually bootstrap themselves. Most allocators 364 * have the problem that the structures used for managing slab caches are 365 * allocated from slab caches themselves. 366 */ 367 enum slab_state { 368 DOWN, /* No slab functionality yet */ 369 PARTIAL, /* SLUB: kmem_cache_node available */ 370 UP, /* Slab caches usable but not all extras yet */ 371 FULL /* Everything is working */ 372 }; 373 374 extern enum slab_state slab_state; 375 376 /* The slab cache mutex protects the management structures during changes */ 377 extern struct mutex slab_mutex; 378 379 /* The list of all slab caches on the system */ 380 extern struct list_head slab_caches; 381 382 /* The slab cache that manages slab cache information */ 383 extern struct kmem_cache *kmem_cache; 384 385 /* A table of kmalloc cache names and sizes */ 386 extern const struct kmalloc_info_struct { 387 const char *name[NR_KMALLOC_TYPES]; 388 unsigned int size; 389 } kmalloc_info[]; 390 391 /* Kmalloc array related functions */ 392 void setup_kmalloc_cache_index_table(void); 393 void create_kmalloc_caches(void); 394 395 extern u8 kmalloc_size_index[24]; 396 397 static inline unsigned int size_index_elem(unsigned int bytes) 398 { 399 return (bytes - 1) / 8; 400 } 401 402 /* 403 * Find the kmem_cache structure that serves a given size of 404 * allocation 405 * 406 * This assumes size is larger than zero and not larger than 407 * KMALLOC_MAX_CACHE_SIZE and the caller must check that. 408 */ 409 static inline struct kmem_cache * 410 kmalloc_slab(size_t size, kmem_buckets *b, gfp_t flags, unsigned long caller) 411 { 412 unsigned int index; 413 414 if (!b) 415 b = &kmalloc_caches[kmalloc_type(flags, caller)]; 416 if (size <= 192) 417 index = kmalloc_size_index[size_index_elem(size)]; 418 else 419 index = fls(size - 1); 420 421 return (*b)[index]; 422 } 423 424 gfp_t kmalloc_fix_flags(gfp_t flags); 425 426 /* Functions provided by the slab allocators */ 427 int __kmem_cache_create(struct kmem_cache *, slab_flags_t flags); 428 429 void __init kmem_cache_init(void); 430 extern void create_boot_cache(struct kmem_cache *, const char *name, 431 unsigned int size, slab_flags_t flags, 432 unsigned int useroffset, unsigned int usersize); 433 434 int slab_unmergeable(struct kmem_cache *s); 435 struct kmem_cache *find_mergeable(unsigned size, unsigned align, 436 slab_flags_t flags, const char *name, void (*ctor)(void *)); 437 struct kmem_cache * 438 __kmem_cache_alias(const char *name, unsigned int size, unsigned int align, 439 slab_flags_t flags, void (*ctor)(void *)); 440 441 slab_flags_t kmem_cache_flags(slab_flags_t flags, const char *name); 442 443 static inline bool is_kmalloc_cache(struct kmem_cache *s) 444 { 445 return (s->flags & SLAB_KMALLOC); 446 } 447 448 /* Legal flag mask for kmem_cache_create(), for various configurations */ 449 #define SLAB_CORE_FLAGS (SLAB_HWCACHE_ALIGN | SLAB_CACHE_DMA | \ 450 SLAB_CACHE_DMA32 | SLAB_PANIC | \ 451 SLAB_TYPESAFE_BY_RCU | SLAB_DEBUG_OBJECTS ) 452 453 #ifdef CONFIG_SLUB_DEBUG 454 #define SLAB_DEBUG_FLAGS (SLAB_RED_ZONE | SLAB_POISON | SLAB_STORE_USER | \ 455 SLAB_TRACE | SLAB_CONSISTENCY_CHECKS) 456 #else 457 #define SLAB_DEBUG_FLAGS (0) 458 #endif 459 460 #define SLAB_CACHE_FLAGS (SLAB_NOLEAKTRACE | SLAB_RECLAIM_ACCOUNT | \ 461 SLAB_TEMPORARY | SLAB_ACCOUNT | \ 462 SLAB_NO_USER_FLAGS | SLAB_KMALLOC | SLAB_NO_MERGE) 463 464 /* Common flags available with current configuration */ 465 #define CACHE_CREATE_MASK (SLAB_CORE_FLAGS | SLAB_DEBUG_FLAGS | SLAB_CACHE_FLAGS) 466 467 /* Common flags permitted for kmem_cache_create */ 468 #define SLAB_FLAGS_PERMITTED (SLAB_CORE_FLAGS | \ 469 SLAB_RED_ZONE | \ 470 SLAB_POISON | \ 471 SLAB_STORE_USER | \ 472 SLAB_TRACE | \ 473 SLAB_CONSISTENCY_CHECKS | \ 474 SLAB_NOLEAKTRACE | \ 475 SLAB_RECLAIM_ACCOUNT | \ 476 SLAB_TEMPORARY | \ 477 SLAB_ACCOUNT | \ 478 SLAB_KMALLOC | \ 479 SLAB_NO_MERGE | \ 480 SLAB_NO_USER_FLAGS) 481 482 bool __kmem_cache_empty(struct kmem_cache *); 483 int __kmem_cache_shutdown(struct kmem_cache *); 484 void __kmem_cache_release(struct kmem_cache *); 485 int __kmem_cache_shrink(struct kmem_cache *); 486 void slab_kmem_cache_release(struct kmem_cache *); 487 488 struct seq_file; 489 struct file; 490 491 struct slabinfo { 492 unsigned long active_objs; 493 unsigned long num_objs; 494 unsigned long active_slabs; 495 unsigned long num_slabs; 496 unsigned long shared_avail; 497 unsigned int limit; 498 unsigned int batchcount; 499 unsigned int shared; 500 unsigned int objects_per_slab; 501 unsigned int cache_order; 502 }; 503 504 void get_slabinfo(struct kmem_cache *s, struct slabinfo *sinfo); 505 506 #ifdef CONFIG_SLUB_DEBUG 507 #ifdef CONFIG_SLUB_DEBUG_ON 508 DECLARE_STATIC_KEY_TRUE(slub_debug_enabled); 509 #else 510 DECLARE_STATIC_KEY_FALSE(slub_debug_enabled); 511 #endif 512 extern void print_tracking(struct kmem_cache *s, void *object); 513 long validate_slab_cache(struct kmem_cache *s); 514 static inline bool __slub_debug_enabled(void) 515 { 516 return static_branch_unlikely(&slub_debug_enabled); 517 } 518 #else 519 static inline void print_tracking(struct kmem_cache *s, void *object) 520 { 521 } 522 static inline bool __slub_debug_enabled(void) 523 { 524 return false; 525 } 526 #endif 527 528 /* 529 * Returns true if any of the specified slab_debug flags is enabled for the 530 * cache. Use only for flags parsed by setup_slub_debug() as it also enables 531 * the static key. 532 */ 533 static inline bool kmem_cache_debug_flags(struct kmem_cache *s, slab_flags_t flags) 534 { 535 if (IS_ENABLED(CONFIG_SLUB_DEBUG)) 536 VM_WARN_ON_ONCE(!(flags & SLAB_DEBUG_FLAGS)); 537 if (__slub_debug_enabled()) 538 return s->flags & flags; 539 return false; 540 } 541 542 #ifdef CONFIG_SLAB_OBJ_EXT 543 544 /* 545 * slab_obj_exts - get the pointer to the slab object extension vector 546 * associated with a slab. 547 * @slab: a pointer to the slab struct 548 * 549 * Returns a pointer to the object extension vector associated with the slab, 550 * or NULL if no such vector has been associated yet. 551 */ 552 static inline struct slabobj_ext *slab_obj_exts(struct slab *slab) 553 { 554 unsigned long obj_exts = READ_ONCE(slab->obj_exts); 555 556 #ifdef CONFIG_MEMCG 557 VM_BUG_ON_PAGE(obj_exts && !(obj_exts & MEMCG_DATA_OBJEXTS), 558 slab_page(slab)); 559 VM_BUG_ON_PAGE(obj_exts & MEMCG_DATA_KMEM, slab_page(slab)); 560 #endif 561 return (struct slabobj_ext *)(obj_exts & ~OBJEXTS_FLAGS_MASK); 562 } 563 564 int alloc_slab_obj_exts(struct slab *slab, struct kmem_cache *s, 565 gfp_t gfp, bool new_slab); 566 567 #else /* CONFIG_SLAB_OBJ_EXT */ 568 569 static inline struct slabobj_ext *slab_obj_exts(struct slab *slab) 570 { 571 return NULL; 572 } 573 574 #endif /* CONFIG_SLAB_OBJ_EXT */ 575 576 static inline enum node_stat_item cache_vmstat_idx(struct kmem_cache *s) 577 { 578 return (s->flags & SLAB_RECLAIM_ACCOUNT) ? 579 NR_SLAB_RECLAIMABLE_B : NR_SLAB_UNRECLAIMABLE_B; 580 } 581 582 #ifdef CONFIG_MEMCG 583 bool __memcg_slab_post_alloc_hook(struct kmem_cache *s, struct list_lru *lru, 584 gfp_t flags, size_t size, void **p); 585 void __memcg_slab_free_hook(struct kmem_cache *s, struct slab *slab, 586 void **p, int objects, struct slabobj_ext *obj_exts); 587 #endif 588 589 size_t __ksize(const void *objp); 590 591 static inline size_t slab_ksize(const struct kmem_cache *s) 592 { 593 #ifdef CONFIG_SLUB_DEBUG 594 /* 595 * Debugging requires use of the padding between object 596 * and whatever may come after it. 597 */ 598 if (s->flags & (SLAB_RED_ZONE | SLAB_POISON)) 599 return s->object_size; 600 #endif 601 if (s->flags & SLAB_KASAN) 602 return s->object_size; 603 /* 604 * If we have the need to store the freelist pointer 605 * back there or track user information then we can 606 * only use the space before that information. 607 */ 608 if (s->flags & (SLAB_TYPESAFE_BY_RCU | SLAB_STORE_USER)) 609 return s->inuse; 610 /* 611 * Else we can use all the padding etc for the allocation 612 */ 613 return s->size; 614 } 615 616 #ifdef CONFIG_SLUB_DEBUG 617 void dump_unreclaimable_slab(void); 618 #else 619 static inline void dump_unreclaimable_slab(void) 620 { 621 } 622 #endif 623 624 void ___cache_free(struct kmem_cache *cache, void *x, unsigned long addr); 625 626 #ifdef CONFIG_SLAB_FREELIST_RANDOM 627 int cache_random_seq_create(struct kmem_cache *cachep, unsigned int count, 628 gfp_t gfp); 629 void cache_random_seq_destroy(struct kmem_cache *cachep); 630 #else 631 static inline int cache_random_seq_create(struct kmem_cache *cachep, 632 unsigned int count, gfp_t gfp) 633 { 634 return 0; 635 } 636 static inline void cache_random_seq_destroy(struct kmem_cache *cachep) { } 637 #endif /* CONFIG_SLAB_FREELIST_RANDOM */ 638 639 static inline bool slab_want_init_on_alloc(gfp_t flags, struct kmem_cache *c) 640 { 641 if (static_branch_maybe(CONFIG_INIT_ON_ALLOC_DEFAULT_ON, 642 &init_on_alloc)) { 643 if (c->ctor) 644 return false; 645 if (c->flags & (SLAB_TYPESAFE_BY_RCU | SLAB_POISON)) 646 return flags & __GFP_ZERO; 647 return true; 648 } 649 return flags & __GFP_ZERO; 650 } 651 652 static inline bool slab_want_init_on_free(struct kmem_cache *c) 653 { 654 if (static_branch_maybe(CONFIG_INIT_ON_FREE_DEFAULT_ON, 655 &init_on_free)) 656 return !(c->ctor || 657 (c->flags & (SLAB_TYPESAFE_BY_RCU | SLAB_POISON))); 658 return false; 659 } 660 661 #if defined(CONFIG_DEBUG_FS) && defined(CONFIG_SLUB_DEBUG) 662 void debugfs_slab_release(struct kmem_cache *); 663 #else 664 static inline void debugfs_slab_release(struct kmem_cache *s) { } 665 #endif 666 667 #ifdef CONFIG_PRINTK 668 #define KS_ADDRS_COUNT 16 669 struct kmem_obj_info { 670 void *kp_ptr; 671 struct slab *kp_slab; 672 void *kp_objp; 673 unsigned long kp_data_offset; 674 struct kmem_cache *kp_slab_cache; 675 void *kp_ret; 676 void *kp_stack[KS_ADDRS_COUNT]; 677 void *kp_free_stack[KS_ADDRS_COUNT]; 678 }; 679 void __kmem_obj_info(struct kmem_obj_info *kpp, void *object, struct slab *slab); 680 #endif 681 682 void __check_heap_object(const void *ptr, unsigned long n, 683 const struct slab *slab, bool to_user); 684 685 #ifdef CONFIG_SLUB_DEBUG 686 void skip_orig_size_check(struct kmem_cache *s, const void *object); 687 #endif 688 689 #endif /* MM_SLAB_H */ 690