slab.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. /*
  2. * Written by Mark Hemment, 1996 (markhe@nextd.demon.co.uk).
  3. *
  4. * (C) SGI 2006, Christoph Lameter
  5. * Cleaned up and restructured to ease the addition of alternative
  6. * implementations of SLAB allocators.
  7. */
  8. #ifndef _LINUX_SLAB_H
  9. #define _LINUX_SLAB_H
  10. #include <linux/gfp.h>
  11. #include <linux/types.h>
  12. #include <linux/workqueue.h>
  13. /*
  14. * Flags to pass to kmem_cache_create().
  15. * The ones marked DEBUG are only valid if CONFIG_SLAB_DEBUG is set.
  16. */
  17. #define SLAB_DEBUG_FREE 0x00000100UL /* DEBUG: Perform (expensive) checks on free */
  18. #define SLAB_RED_ZONE 0x00000400UL /* DEBUG: Red zone objs in a cache */
  19. #define SLAB_POISON 0x00000800UL /* DEBUG: Poison objects */
  20. #define SLAB_HWCACHE_ALIGN 0x00002000UL /* Align objs on cache lines */
  21. #define SLAB_CACHE_DMA 0x00004000UL /* Use GFP_DMA memory */
  22. #define SLAB_STORE_USER 0x00010000UL /* DEBUG: Store the last owner for bug hunting */
  23. #define SLAB_PANIC 0x00040000UL /* Panic if kmem_cache_create() fails */
  24. /*
  25. * SLAB_DESTROY_BY_RCU - **WARNING** READ THIS!
  26. *
  27. * This delays freeing the SLAB page by a grace period, it does _NOT_
  28. * delay object freeing. This means that if you do kmem_cache_free()
  29. * that memory location is free to be reused at any time. Thus it may
  30. * be possible to see another object there in the same RCU grace period.
  31. *
  32. * This feature only ensures the memory location backing the object
  33. * stays valid, the trick to using this is relying on an independent
  34. * object validation pass. Something like:
  35. *
  36. * rcu_read_lock()
  37. * again:
  38. * obj = lockless_lookup(key);
  39. * if (obj) {
  40. * if (!try_get_ref(obj)) // might fail for free objects
  41. * goto again;
  42. *
  43. * if (obj->key != key) { // not the object we expected
  44. * put_ref(obj);
  45. * goto again;
  46. * }
  47. * }
  48. * rcu_read_unlock();
  49. *
  50. * See also the comment on struct slab_rcu in mm/slab.c.
  51. */
  52. #define SLAB_DESTROY_BY_RCU 0x00080000UL /* Defer freeing slabs to RCU */
  53. #define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */
  54. #define SLAB_TRACE 0x00200000UL /* Trace allocations and frees */
  55. /* Flag to prevent checks on free */
  56. #ifdef CONFIG_DEBUG_OBJECTS
  57. # define SLAB_DEBUG_OBJECTS 0x00400000UL
  58. #else
  59. # define SLAB_DEBUG_OBJECTS 0x00000000UL
  60. #endif
  61. #define SLAB_NOLEAKTRACE 0x00800000UL /* Avoid kmemleak tracing */
  62. /* Don't track use of uninitialized memory */
  63. #ifdef CONFIG_KMEMCHECK
  64. # define SLAB_NOTRACK 0x01000000UL
  65. #else
  66. # define SLAB_NOTRACK 0x00000000UL
  67. #endif
  68. #ifdef CONFIG_FAILSLAB
  69. # define SLAB_FAILSLAB 0x02000000UL /* Fault injection mark */
  70. #else
  71. # define SLAB_FAILSLAB 0x00000000UL
  72. #endif
  73. /* The following flags affect the page allocator grouping pages by mobility */
  74. #define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */
  75. #define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */
  76. /*
  77. * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests.
  78. *
  79. * Dereferencing ZERO_SIZE_PTR will lead to a distinct access fault.
  80. *
  81. * ZERO_SIZE_PTR can be passed to kfree though in the same way that NULL can.
  82. * Both make kfree a no-op.
  83. */
  84. #define ZERO_SIZE_PTR ((void *)16)
  85. #define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= \
  86. (unsigned long)ZERO_SIZE_PTR)
  87. struct mem_cgroup;
  88. /*
  89. * struct kmem_cache related prototypes
  90. */
  91. void __init kmem_cache_init(void);
  92. int slab_is_available(void);
  93. struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
  94. unsigned long,
  95. void (*)(void *));
  96. struct kmem_cache *
  97. kmem_cache_create_memcg(struct mem_cgroup *, const char *, size_t, size_t,
  98. unsigned long, void (*)(void *), struct kmem_cache *);
  99. void kmem_cache_destroy(struct kmem_cache *);
  100. int kmem_cache_shrink(struct kmem_cache *);
  101. void kmem_cache_free(struct kmem_cache *, void *);
  102. /*
  103. * Please use this macro to create slab caches. Simply specify the
  104. * name of the structure and maybe some flags that are listed above.
  105. *
  106. * The alignment of the struct determines object alignment. If you
  107. * f.e. add ____cacheline_aligned_in_smp to the struct declaration
  108. * then the objects will be properly aligned in SMP configurations.
  109. */
  110. #define KMEM_CACHE(__struct, __flags) kmem_cache_create(#__struct,\
  111. sizeof(struct __struct), __alignof__(struct __struct),\
  112. (__flags), NULL)
  113. /*
  114. * Common kmalloc functions provided by all allocators
  115. */
  116. void * __must_check __krealloc(const void *, size_t, gfp_t);
  117. void * __must_check krealloc(const void *, size_t, gfp_t);
  118. void kfree(const void *);
  119. void kzfree(const void *);
  120. size_t ksize(const void *);
  121. /*
  122. * Some archs want to perform DMA into kmalloc caches and need a guaranteed
  123. * alignment larger than the alignment of a 64-bit integer.
  124. * Setting ARCH_KMALLOC_MINALIGN in arch headers allows that.
  125. */
  126. #if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
  127. #define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
  128. #define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
  129. #define KMALLOC_SHIFT_LOW ilog2(ARCH_DMA_MINALIGN)
  130. #else
  131. #define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
  132. #endif
  133. #ifdef CONFIG_SLOB
  134. /*
  135. * Common fields provided in kmem_cache by all slab allocators
  136. * This struct is either used directly by the allocator (SLOB)
  137. * or the allocator must include definitions for all fields
  138. * provided in kmem_cache_common in their definition of kmem_cache.
  139. *
  140. * Once we can do anonymous structs (C11 standard) we could put a
  141. * anonymous struct definition in these allocators so that the
  142. * separate allocations in the kmem_cache structure of SLAB and
  143. * SLUB is no longer needed.
  144. */
  145. struct kmem_cache {
  146. unsigned int object_size;/* The original size of the object */
  147. unsigned int size; /* The aligned/padded/added on size */
  148. unsigned int align; /* Alignment as calculated */
  149. unsigned long flags; /* Active flags on the slab */
  150. const char *name; /* Slab name for sysfs */
  151. int refcount; /* Use counter */
  152. void (*ctor)(void *); /* Called on object slot creation */
  153. struct list_head list; /* List of all slab caches on the system */
  154. };
  155. #endif /* CONFIG_SLOB */
  156. /*
  157. * Kmalloc array related definitions
  158. */
  159. #ifdef CONFIG_SLAB
  160. /*
  161. * The largest kmalloc size supported by the SLAB allocators is
  162. * 32 megabyte (2^25) or the maximum allocatable page order if that is
  163. * less than 32 MB.
  164. *
  165. * WARNING: Its not easy to increase this value since the allocators have
  166. * to do various tricks to work around compiler limitations in order to
  167. * ensure proper constant folding.
  168. */
  169. #define KMALLOC_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT - 1) <= 25 ? \
  170. (MAX_ORDER + PAGE_SHIFT - 1) : 25)
  171. #define KMALLOC_SHIFT_MAX KMALLOC_SHIFT_HIGH
  172. #ifndef KMALLOC_SHIFT_LOW
  173. #define KMALLOC_SHIFT_LOW 5
  174. #endif
  175. #endif
  176. #ifdef CONFIG_SLUB
  177. /*
  178. * SLUB allocates up to order 2 pages directly and otherwise
  179. * passes the request to the page allocator.
  180. */
  181. #define KMALLOC_SHIFT_HIGH (PAGE_SHIFT + 1)
  182. #define KMALLOC_SHIFT_MAX (MAX_ORDER + PAGE_SHIFT)
  183. #ifndef KMALLOC_SHIFT_LOW
  184. #define KMALLOC_SHIFT_LOW 3
  185. #endif
  186. #endif
  187. #ifdef CONFIG_SLOB
  188. /*
  189. * SLOB passes all page size and larger requests to the page allocator.
  190. * No kmalloc array is necessary since objects of different sizes can
  191. * be allocated from the same page.
  192. */
  193. #define KMALLOC_SHIFT_MAX 30
  194. #define KMALLOC_SHIFT_HIGH PAGE_SHIFT
  195. #ifndef KMALLOC_SHIFT_LOW
  196. #define KMALLOC_SHIFT_LOW 3
  197. #endif
  198. #endif
  199. /* Maximum allocatable size */
  200. #define KMALLOC_MAX_SIZE (1UL << KMALLOC_SHIFT_MAX)
  201. /* Maximum size for which we actually use a slab cache */
  202. #define KMALLOC_MAX_CACHE_SIZE (1UL << KMALLOC_SHIFT_HIGH)
  203. /* Maximum order allocatable via the slab allocagtor */
  204. #define KMALLOC_MAX_ORDER (KMALLOC_SHIFT_MAX - PAGE_SHIFT)
  205. /*
  206. * Kmalloc subsystem.
  207. */
  208. #ifndef KMALLOC_MIN_SIZE
  209. #define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW)
  210. #endif
  211. #ifndef CONFIG_SLOB
  212. extern struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1];
  213. #ifdef CONFIG_ZONE_DMA
  214. extern struct kmem_cache *kmalloc_dma_caches[KMALLOC_SHIFT_HIGH + 1];
  215. #endif
  216. /*
  217. * Figure out which kmalloc slab an allocation of a certain size
  218. * belongs to.
  219. * 0 = zero alloc
  220. * 1 = 65 .. 96 bytes
  221. * 2 = 120 .. 192 bytes
  222. * n = 2^(n-1) .. 2^n -1
  223. */
  224. static __always_inline int kmalloc_index(size_t size)
  225. {
  226. if (!size)
  227. return 0;
  228. if (size <= KMALLOC_MIN_SIZE)
  229. return KMALLOC_SHIFT_LOW;
  230. if (KMALLOC_MIN_SIZE <= 32 && size > 64 && size <= 96)
  231. return 1;
  232. if (KMALLOC_MIN_SIZE <= 64 && size > 128 && size <= 192)
  233. return 2;
  234. if (size <= 8) return 3;
  235. if (size <= 16) return 4;
  236. if (size <= 32) return 5;
  237. if (size <= 64) return 6;
  238. if (size <= 128) return 7;
  239. if (size <= 256) return 8;
  240. if (size <= 512) return 9;
  241. if (size <= 1024) return 10;
  242. if (size <= 2 * 1024) return 11;
  243. if (size <= 4 * 1024) return 12;
  244. if (size <= 8 * 1024) return 13;
  245. if (size <= 16 * 1024) return 14;
  246. if (size <= 32 * 1024) return 15;
  247. if (size <= 64 * 1024) return 16;
  248. if (size <= 128 * 1024) return 17;
  249. if (size <= 256 * 1024) return 18;
  250. if (size <= 512 * 1024) return 19;
  251. if (size <= 1024 * 1024) return 20;
  252. if (size <= 2 * 1024 * 1024) return 21;
  253. if (size <= 4 * 1024 * 1024) return 22;
  254. if (size <= 8 * 1024 * 1024) return 23;
  255. if (size <= 16 * 1024 * 1024) return 24;
  256. if (size <= 32 * 1024 * 1024) return 25;
  257. if (size <= 64 * 1024 * 1024) return 26;
  258. BUG();
  259. /* Will never be reached. Needed because the compiler may complain */
  260. return -1;
  261. }
  262. #endif /* !CONFIG_SLOB */
  263. #ifdef CONFIG_SLAB
  264. #include <linux/slab_def.h>
  265. #endif
  266. #ifdef CONFIG_SLUB
  267. #include <linux/slub_def.h>
  268. #endif
  269. #ifdef CONFIG_SLOB
  270. #include <linux/slob_def.h>
  271. #endif
  272. /*
  273. * Determine size used for the nth kmalloc cache.
  274. * return size or 0 if a kmalloc cache for that
  275. * size does not exist
  276. */
  277. static __always_inline int kmalloc_size(int n)
  278. {
  279. #ifndef CONFIG_SLOB
  280. if (n > 2)
  281. return 1 << n;
  282. if (n == 1 && KMALLOC_MIN_SIZE <= 32)
  283. return 96;
  284. if (n == 2 && KMALLOC_MIN_SIZE <= 64)
  285. return 192;
  286. #endif
  287. return 0;
  288. }
  289. /*
  290. * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment.
  291. * Intended for arches that get misalignment faults even for 64 bit integer
  292. * aligned buffers.
  293. */
  294. #ifndef ARCH_SLAB_MINALIGN
  295. #define ARCH_SLAB_MINALIGN __alignof__(unsigned long long)
  296. #endif
  297. /*
  298. * This is the main placeholder for memcg-related information in kmem caches.
  299. * struct kmem_cache will hold a pointer to it, so the memory cost while
  300. * disabled is 1 pointer. The runtime cost while enabled, gets bigger than it
  301. * would otherwise be if that would be bundled in kmem_cache: we'll need an
  302. * extra pointer chase. But the trade off clearly lays in favor of not
  303. * penalizing non-users.
  304. *
  305. * Both the root cache and the child caches will have it. For the root cache,
  306. * this will hold a dynamically allocated array large enough to hold
  307. * information about the currently limited memcgs in the system.
  308. *
  309. * Child caches will hold extra metadata needed for its operation. Fields are:
  310. *
  311. * @memcg: pointer to the memcg this cache belongs to
  312. * @list: list_head for the list of all caches in this memcg
  313. * @root_cache: pointer to the global, root cache, this cache was derived from
  314. * @dead: set to true after the memcg dies; the cache may still be around.
  315. * @nr_pages: number of pages that belongs to this cache.
  316. * @destroy: worker to be called whenever we are ready, or believe we may be
  317. * ready, to destroy this cache.
  318. */
  319. struct memcg_cache_params {
  320. bool is_root_cache;
  321. union {
  322. struct kmem_cache *memcg_caches[0];
  323. struct {
  324. struct mem_cgroup *memcg;
  325. struct list_head list;
  326. struct kmem_cache *root_cache;
  327. bool dead;
  328. atomic_t nr_pages;
  329. struct work_struct destroy;
  330. };
  331. };
  332. };
  333. int memcg_update_all_caches(int num_memcgs);
  334. struct seq_file;
  335. int cache_show(struct kmem_cache *s, struct seq_file *m);
  336. void print_slabinfo_header(struct seq_file *m);
  337. /**
  338. * kmalloc - allocate memory
  339. * @size: how many bytes of memory are required.
  340. * @flags: the type of memory to allocate.
  341. *
  342. * The @flags argument may be one of:
  343. *
  344. * %GFP_USER - Allocate memory on behalf of user. May sleep.
  345. *
  346. * %GFP_KERNEL - Allocate normal kernel ram. May sleep.
  347. *
  348. * %GFP_ATOMIC - Allocation will not sleep. May use emergency pools.
  349. * For example, use this inside interrupt handlers.
  350. *
  351. * %GFP_HIGHUSER - Allocate pages from high memory.
  352. *
  353. * %GFP_NOIO - Do not do any I/O at all while trying to get memory.
  354. *
  355. * %GFP_NOFS - Do not make any fs calls while trying to get memory.
  356. *
  357. * %GFP_NOWAIT - Allocation will not sleep.
  358. *
  359. * %GFP_THISNODE - Allocate node-local memory only.
  360. *
  361. * %GFP_DMA - Allocation suitable for DMA.
  362. * Should only be used for kmalloc() caches. Otherwise, use a
  363. * slab created with SLAB_DMA.
  364. *
  365. * Also it is possible to set different flags by OR'ing
  366. * in one or more of the following additional @flags:
  367. *
  368. * %__GFP_COLD - Request cache-cold pages instead of
  369. * trying to return cache-warm pages.
  370. *
  371. * %__GFP_HIGH - This allocation has high priority and may use emergency pools.
  372. *
  373. * %__GFP_NOFAIL - Indicate that this allocation is in no way allowed to fail
  374. * (think twice before using).
  375. *
  376. * %__GFP_NORETRY - If memory is not immediately available,
  377. * then give up at once.
  378. *
  379. * %__GFP_NOWARN - If allocation fails, don't issue any warnings.
  380. *
  381. * %__GFP_REPEAT - If allocation fails initially, try once more before failing.
  382. *
  383. * There are other flags available as well, but these are not intended
  384. * for general use, and so are not documented here. For a full list of
  385. * potential flags, always refer to linux/gfp.h.
  386. *
  387. * kmalloc is the normal method of allocating memory
  388. * in the kernel.
  389. */
  390. static __always_inline void *kmalloc(size_t size, gfp_t flags);
  391. /**
  392. * kmalloc_array - allocate memory for an array.
  393. * @n: number of elements.
  394. * @size: element size.
  395. * @flags: the type of memory to allocate (see kmalloc).
  396. */
  397. static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
  398. {
  399. if (size != 0 && n > SIZE_MAX / size)
  400. return NULL;
  401. return __kmalloc(n * size, flags);
  402. }
  403. /**
  404. * kcalloc - allocate memory for an array. The memory is set to zero.
  405. * @n: number of elements.
  406. * @size: element size.
  407. * @flags: the type of memory to allocate (see kmalloc).
  408. */
  409. static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
  410. {
  411. return kmalloc_array(n, size, flags | __GFP_ZERO);
  412. }
  413. #if !defined(CONFIG_NUMA) && !defined(CONFIG_SLOB)
  414. /**
  415. * kmalloc_node - allocate memory from a specific node
  416. * @size: how many bytes of memory are required.
  417. * @flags: the type of memory to allocate (see kmalloc).
  418. * @node: node to allocate from.
  419. *
  420. * kmalloc() for non-local nodes, used to allocate from a specific node
  421. * if available. Equivalent to kmalloc() in the non-NUMA single-node
  422. * case.
  423. */
  424. static inline void *kmalloc_node(size_t size, gfp_t flags, int node)
  425. {
  426. return kmalloc(size, flags);
  427. }
  428. static inline void *__kmalloc_node(size_t size, gfp_t flags, int node)
  429. {
  430. return __kmalloc(size, flags);
  431. }
  432. void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
  433. static inline void *kmem_cache_alloc_node(struct kmem_cache *cachep,
  434. gfp_t flags, int node)
  435. {
  436. return kmem_cache_alloc(cachep, flags);
  437. }
  438. #endif /* !CONFIG_NUMA && !CONFIG_SLOB */
  439. /*
  440. * kmalloc_track_caller is a special version of kmalloc that records the
  441. * calling function of the routine calling it for slab leak tracking instead
  442. * of just the calling function (confusing, eh?).
  443. * It's useful when the call to kmalloc comes from a widely-used standard
  444. * allocator where we care about the real place the memory allocation
  445. * request comes from.
  446. */
  447. #if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \
  448. (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) || \
  449. (defined(CONFIG_SLOB) && defined(CONFIG_TRACING))
  450. extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long);
  451. #define kmalloc_track_caller(size, flags) \
  452. __kmalloc_track_caller(size, flags, _RET_IP_)
  453. #else
  454. #define kmalloc_track_caller(size, flags) \
  455. __kmalloc(size, flags)
  456. #endif /* DEBUG_SLAB */
  457. #ifdef CONFIG_NUMA
  458. /*
  459. * kmalloc_node_track_caller is a special version of kmalloc_node that
  460. * records the calling function of the routine calling it for slab leak
  461. * tracking instead of just the calling function (confusing, eh?).
  462. * It's useful when the call to kmalloc_node comes from a widely-used
  463. * standard allocator where we care about the real place the memory
  464. * allocation request comes from.
  465. */
  466. #if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \
  467. (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) || \
  468. (defined(CONFIG_SLOB) && defined(CONFIG_TRACING))
  469. extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long);
  470. #define kmalloc_node_track_caller(size, flags, node) \
  471. __kmalloc_node_track_caller(size, flags, node, \
  472. _RET_IP_)
  473. #else
  474. #define kmalloc_node_track_caller(size, flags, node) \
  475. __kmalloc_node(size, flags, node)
  476. #endif
  477. #else /* CONFIG_NUMA */
  478. #define kmalloc_node_track_caller(size, flags, node) \
  479. kmalloc_track_caller(size, flags)
  480. #endif /* CONFIG_NUMA */
  481. /*
  482. * Shortcuts
  483. */
  484. static inline void *kmem_cache_zalloc(struct kmem_cache *k, gfp_t flags)
  485. {
  486. return kmem_cache_alloc(k, flags | __GFP_ZERO);
  487. }
  488. /**
  489. * kzalloc - allocate memory. The memory is set to zero.
  490. * @size: how many bytes of memory are required.
  491. * @flags: the type of memory to allocate (see kmalloc).
  492. */
  493. static inline void *kzalloc(size_t size, gfp_t flags)
  494. {
  495. return kmalloc(size, flags | __GFP_ZERO);
  496. }
  497. /**
  498. * kzalloc_node - allocate zeroed memory from a particular memory node.
  499. * @size: how many bytes of memory are required.
  500. * @flags: the type of memory to allocate (see kmalloc).
  501. * @node: memory node from which to allocate
  502. */
  503. static inline void *kzalloc_node(size_t size, gfp_t flags, int node)
  504. {
  505. return kmalloc_node(size, flags | __GFP_ZERO, node);
  506. }
  507. /*
  508. * Determine the size of a slab object
  509. */
  510. static inline unsigned int kmem_cache_size(struct kmem_cache *s)
  511. {
  512. return s->object_size;
  513. }
  514. void __init kmem_cache_init_late(void);
  515. #endif /* _LINUX_SLAB_H */