slob.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. /*
  2. * SLOB Allocator: Simple List Of Blocks
  3. *
  4. * Matt Mackall <mpm@selenic.com> 12/30/03
  5. *
  6. * NUMA support by Paul Mundt, 2007.
  7. *
  8. * How SLOB works:
  9. *
  10. * The core of SLOB is a traditional K&R style heap allocator, with
  11. * support for returning aligned objects. The granularity of this
  12. * allocator is as little as 2 bytes, however typically most architectures
  13. * will require 4 bytes on 32-bit and 8 bytes on 64-bit.
  14. *
  15. * The slob heap is a set of linked list of pages from alloc_pages(),
  16. * and within each page, there is a singly-linked list of free blocks
  17. * (slob_t). The heap is grown on demand. To reduce fragmentation,
  18. * heap pages are segregated into three lists, with objects less than
  19. * 256 bytes, objects less than 1024 bytes, and all other objects.
  20. *
  21. * Allocation from heap involves first searching for a page with
  22. * sufficient free blocks (using a next-fit-like approach) followed by
  23. * a first-fit scan of the page. Deallocation inserts objects back
  24. * into the free list in address order, so this is effectively an
  25. * address-ordered first fit.
  26. *
  27. * Above this is an implementation of kmalloc/kfree. Blocks returned
  28. * from kmalloc are prepended with a 4-byte header with the kmalloc size.
  29. * If kmalloc is asked for objects of PAGE_SIZE or larger, it calls
  30. * alloc_pages() directly, allocating compound pages so the page order
  31. * does not have to be separately tracked, and also stores the exact
  32. * allocation size in page->private so that it can be used to accurately
  33. * provide ksize(). These objects are detected in kfree() because slob_page()
  34. * is false for them.
  35. *
  36. * SLAB is emulated on top of SLOB by simply calling constructors and
  37. * destructors for every SLAB allocation. Objects are returned with the
  38. * 4-byte alignment unless the SLAB_HWCACHE_ALIGN flag is set, in which
  39. * case the low-level allocator will fragment blocks to create the proper
  40. * alignment. Again, objects of page-size or greater are allocated by
  41. * calling alloc_pages(). As SLAB objects know their size, no separate
  42. * size bookkeeping is necessary and there is essentially no allocation
  43. * space overhead, and compound pages aren't needed for multi-page
  44. * allocations.
  45. *
  46. * NUMA support in SLOB is fairly simplistic, pushing most of the real
  47. * logic down to the page allocator, and simply doing the node accounting
  48. * on the upper levels. In the event that a node id is explicitly
  49. * provided, alloc_pages_node() with the specified node id is used
  50. * instead. The common case (or when the node id isn't explicitly provided)
  51. * will default to the current node, as per numa_node_id().
  52. *
  53. * Node aware pages are still inserted in to the global freelist, and
  54. * these are scanned for by matching against the node id encoded in the
  55. * page flags. As a result, block allocations that can be satisfied from
  56. * the freelist will only be done so on pages residing on the same node,
  57. * in order to prevent random node placement.
  58. */
  59. #include <linux/kernel.h>
  60. #include <linux/slab.h>
  61. #include <linux/mm.h>
  62. #include <linux/cache.h>
  63. #include <linux/init.h>
  64. #include <linux/module.h>
  65. #include <linux/rcupdate.h>
  66. #include <linux/list.h>
  67. #include <trace/kmemtrace.h>
  68. #include <asm/atomic.h>
  69. /*
  70. * slob_block has a field 'units', which indicates size of block if +ve,
  71. * or offset of next block if -ve (in SLOB_UNITs).
  72. *
  73. * Free blocks of size 1 unit simply contain the offset of the next block.
  74. * Those with larger size contain their size in the first SLOB_UNIT of
  75. * memory, and the offset of the next free block in the second SLOB_UNIT.
  76. */
  77. #if PAGE_SIZE <= (32767 * 2)
  78. typedef s16 slobidx_t;
  79. #else
  80. typedef s32 slobidx_t;
  81. #endif
  82. struct slob_block {
  83. slobidx_t units;
  84. };
  85. typedef struct slob_block slob_t;
  86. /*
  87. * We use struct page fields to manage some slob allocation aspects,
  88. * however to avoid the horrible mess in include/linux/mm_types.h, we'll
  89. * just define our own struct page type variant here.
  90. */
  91. struct slob_page {
  92. union {
  93. struct {
  94. unsigned long flags; /* mandatory */
  95. atomic_t _count; /* mandatory */
  96. slobidx_t units; /* free units left in page */
  97. unsigned long pad[2];
  98. slob_t *free; /* first free slob_t in page */
  99. struct list_head list; /* linked list of free pages */
  100. };
  101. struct page page;
  102. };
  103. };
  104. static inline void struct_slob_page_wrong_size(void)
  105. { BUILD_BUG_ON(sizeof(struct slob_page) != sizeof(struct page)); }
  106. /*
  107. * free_slob_page: call before a slob_page is returned to the page allocator.
  108. */
  109. static inline void free_slob_page(struct slob_page *sp)
  110. {
  111. reset_page_mapcount(&sp->page);
  112. sp->page.mapping = NULL;
  113. }
  114. /*
  115. * All partially free slob pages go on these lists.
  116. */
  117. #define SLOB_BREAK1 256
  118. #define SLOB_BREAK2 1024
  119. static LIST_HEAD(free_slob_small);
  120. static LIST_HEAD(free_slob_medium);
  121. static LIST_HEAD(free_slob_large);
  122. /*
  123. * slob_page: True for all slob pages (false for bigblock pages)
  124. */
  125. static inline int slob_page(struct slob_page *sp)
  126. {
  127. return PageSlobPage((struct page *)sp);
  128. }
  129. static inline void set_slob_page(struct slob_page *sp)
  130. {
  131. __SetPageSlobPage((struct page *)sp);
  132. }
  133. static inline void clear_slob_page(struct slob_page *sp)
  134. {
  135. __ClearPageSlobPage((struct page *)sp);
  136. }
  137. /*
  138. * slob_page_free: true for pages on free_slob_pages list.
  139. */
  140. static inline int slob_page_free(struct slob_page *sp)
  141. {
  142. return PageSlobFree((struct page *)sp);
  143. }
  144. static void set_slob_page_free(struct slob_page *sp, struct list_head *list)
  145. {
  146. list_add(&sp->list, list);
  147. __SetPageSlobFree((struct page *)sp);
  148. }
  149. static inline void clear_slob_page_free(struct slob_page *sp)
  150. {
  151. list_del(&sp->list);
  152. __ClearPageSlobFree((struct page *)sp);
  153. }
  154. #define SLOB_UNIT sizeof(slob_t)
  155. #define SLOB_UNITS(size) (((size) + SLOB_UNIT - 1)/SLOB_UNIT)
  156. #define SLOB_ALIGN L1_CACHE_BYTES
  157. /*
  158. * struct slob_rcu is inserted at the tail of allocated slob blocks, which
  159. * were created with a SLAB_DESTROY_BY_RCU slab. slob_rcu is used to free
  160. * the block using call_rcu.
  161. */
  162. struct slob_rcu {
  163. struct rcu_head head;
  164. int size;
  165. };
  166. /*
  167. * slob_lock protects all slob allocator structures.
  168. */
  169. static DEFINE_SPINLOCK(slob_lock);
  170. /*
  171. * Encode the given size and next info into a free slob block s.
  172. */
  173. static void set_slob(slob_t *s, slobidx_t size, slob_t *next)
  174. {
  175. slob_t *base = (slob_t *)((unsigned long)s & PAGE_MASK);
  176. slobidx_t offset = next - base;
  177. if (size > 1) {
  178. s[0].units = size;
  179. s[1].units = offset;
  180. } else
  181. s[0].units = -offset;
  182. }
  183. /*
  184. * Return the size of a slob block.
  185. */
  186. static slobidx_t slob_units(slob_t *s)
  187. {
  188. if (s->units > 0)
  189. return s->units;
  190. return 1;
  191. }
  192. /*
  193. * Return the next free slob block pointer after this one.
  194. */
  195. static slob_t *slob_next(slob_t *s)
  196. {
  197. slob_t *base = (slob_t *)((unsigned long)s & PAGE_MASK);
  198. slobidx_t next;
  199. if (s[0].units < 0)
  200. next = -s[0].units;
  201. else
  202. next = s[1].units;
  203. return base+next;
  204. }
  205. /*
  206. * Returns true if s is the last free block in its page.
  207. */
  208. static int slob_last(slob_t *s)
  209. {
  210. return !((unsigned long)slob_next(s) & ~PAGE_MASK);
  211. }
  212. static void *slob_new_page(gfp_t gfp, int order, int node)
  213. {
  214. void *page;
  215. #ifdef CONFIG_NUMA
  216. if (node != -1)
  217. page = alloc_pages_node(node, gfp, order);
  218. else
  219. #endif
  220. page = alloc_pages(gfp, order);
  221. if (!page)
  222. return NULL;
  223. return page_address(page);
  224. }
  225. /*
  226. * Allocate a slob block within a given slob_page sp.
  227. */
  228. static void *slob_page_alloc(struct slob_page *sp, size_t size, int align)
  229. {
  230. slob_t *prev, *cur, *aligned = 0;
  231. int delta = 0, units = SLOB_UNITS(size);
  232. for (prev = NULL, cur = sp->free; ; prev = cur, cur = slob_next(cur)) {
  233. slobidx_t avail = slob_units(cur);
  234. if (align) {
  235. aligned = (slob_t *)ALIGN((unsigned long)cur, align);
  236. delta = aligned - cur;
  237. }
  238. if (avail >= units + delta) { /* room enough? */
  239. slob_t *next;
  240. if (delta) { /* need to fragment head to align? */
  241. next = slob_next(cur);
  242. set_slob(aligned, avail - delta, next);
  243. set_slob(cur, delta, aligned);
  244. prev = cur;
  245. cur = aligned;
  246. avail = slob_units(cur);
  247. }
  248. next = slob_next(cur);
  249. if (avail == units) { /* exact fit? unlink. */
  250. if (prev)
  251. set_slob(prev, slob_units(prev), next);
  252. else
  253. sp->free = next;
  254. } else { /* fragment */
  255. if (prev)
  256. set_slob(prev, slob_units(prev), cur + units);
  257. else
  258. sp->free = cur + units;
  259. set_slob(cur + units, avail - units, next);
  260. }
  261. sp->units -= units;
  262. if (!sp->units)
  263. clear_slob_page_free(sp);
  264. return cur;
  265. }
  266. if (slob_last(cur))
  267. return NULL;
  268. }
  269. }
  270. /*
  271. * slob_alloc: entry point into the slob allocator.
  272. */
  273. static void *slob_alloc(size_t size, gfp_t gfp, int align, int node)
  274. {
  275. struct slob_page *sp;
  276. struct list_head *prev;
  277. struct list_head *slob_list;
  278. slob_t *b = NULL;
  279. unsigned long flags;
  280. if (size < SLOB_BREAK1)
  281. slob_list = &free_slob_small;
  282. else if (size < SLOB_BREAK2)
  283. slob_list = &free_slob_medium;
  284. else
  285. slob_list = &free_slob_large;
  286. spin_lock_irqsave(&slob_lock, flags);
  287. /* Iterate through each partially free page, try to find room */
  288. list_for_each_entry(sp, slob_list, list) {
  289. #ifdef CONFIG_NUMA
  290. /*
  291. * If there's a node specification, search for a partial
  292. * page with a matching node id in the freelist.
  293. */
  294. if (node != -1 && page_to_nid(&sp->page) != node)
  295. continue;
  296. #endif
  297. /* Enough room on this page? */
  298. if (sp->units < SLOB_UNITS(size))
  299. continue;
  300. /* Attempt to alloc */
  301. prev = sp->list.prev;
  302. b = slob_page_alloc(sp, size, align);
  303. if (!b)
  304. continue;
  305. /* Improve fragment distribution and reduce our average
  306. * search time by starting our next search here. (see
  307. * Knuth vol 1, sec 2.5, pg 449) */
  308. if (prev != slob_list->prev &&
  309. slob_list->next != prev->next)
  310. list_move_tail(slob_list, prev->next);
  311. break;
  312. }
  313. spin_unlock_irqrestore(&slob_lock, flags);
  314. /* Not enough space: must allocate a new page */
  315. if (!b) {
  316. b = slob_new_page(gfp & ~__GFP_ZERO, 0, node);
  317. if (!b)
  318. return 0;
  319. sp = (struct slob_page *)virt_to_page(b);
  320. set_slob_page(sp);
  321. spin_lock_irqsave(&slob_lock, flags);
  322. sp->units = SLOB_UNITS(PAGE_SIZE);
  323. sp->free = b;
  324. INIT_LIST_HEAD(&sp->list);
  325. set_slob(b, SLOB_UNITS(PAGE_SIZE), b + SLOB_UNITS(PAGE_SIZE));
  326. set_slob_page_free(sp, slob_list);
  327. b = slob_page_alloc(sp, size, align);
  328. BUG_ON(!b);
  329. spin_unlock_irqrestore(&slob_lock, flags);
  330. }
  331. if (unlikely((gfp & __GFP_ZERO) && b))
  332. memset(b, 0, size);
  333. return b;
  334. }
  335. /*
  336. * slob_free: entry point into the slob allocator.
  337. */
  338. static void slob_free(void *block, int size)
  339. {
  340. struct slob_page *sp;
  341. slob_t *prev, *next, *b = (slob_t *)block;
  342. slobidx_t units;
  343. unsigned long flags;
  344. if (unlikely(ZERO_OR_NULL_PTR(block)))
  345. return;
  346. BUG_ON(!size);
  347. sp = (struct slob_page *)virt_to_page(block);
  348. units = SLOB_UNITS(size);
  349. spin_lock_irqsave(&slob_lock, flags);
  350. if (sp->units + units == SLOB_UNITS(PAGE_SIZE)) {
  351. /* Go directly to page allocator. Do not pass slob allocator */
  352. if (slob_page_free(sp))
  353. clear_slob_page_free(sp);
  354. clear_slob_page(sp);
  355. free_slob_page(sp);
  356. free_page((unsigned long)b);
  357. goto out;
  358. }
  359. if (!slob_page_free(sp)) {
  360. /* This slob page is about to become partially free. Easy! */
  361. sp->units = units;
  362. sp->free = b;
  363. set_slob(b, units,
  364. (void *)((unsigned long)(b +
  365. SLOB_UNITS(PAGE_SIZE)) & PAGE_MASK));
  366. set_slob_page_free(sp, &free_slob_small);
  367. goto out;
  368. }
  369. /*
  370. * Otherwise the page is already partially free, so find reinsertion
  371. * point.
  372. */
  373. sp->units += units;
  374. if (b < sp->free) {
  375. if (b + units == sp->free) {
  376. units += slob_units(sp->free);
  377. sp->free = slob_next(sp->free);
  378. }
  379. set_slob(b, units, sp->free);
  380. sp->free = b;
  381. } else {
  382. prev = sp->free;
  383. next = slob_next(prev);
  384. while (b > next) {
  385. prev = next;
  386. next = slob_next(prev);
  387. }
  388. if (!slob_last(prev) && b + units == next) {
  389. units += slob_units(next);
  390. set_slob(b, units, slob_next(next));
  391. } else
  392. set_slob(b, units, next);
  393. if (prev + slob_units(prev) == b) {
  394. units = slob_units(b) + slob_units(prev);
  395. set_slob(prev, units, slob_next(b));
  396. } else
  397. set_slob(prev, slob_units(prev), b);
  398. }
  399. out:
  400. spin_unlock_irqrestore(&slob_lock, flags);
  401. }
  402. /*
  403. * End of slob allocator proper. Begin kmem_cache_alloc and kmalloc frontend.
  404. */
  405. #ifndef ARCH_KMALLOC_MINALIGN
  406. #define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long)
  407. #endif
  408. #ifndef ARCH_SLAB_MINALIGN
  409. #define ARCH_SLAB_MINALIGN __alignof__(unsigned long)
  410. #endif
  411. void *__kmalloc_node(size_t size, gfp_t gfp, int node)
  412. {
  413. unsigned int *m;
  414. int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
  415. void *ret;
  416. lockdep_trace_alloc(flags);
  417. if (size < PAGE_SIZE - align) {
  418. if (!size)
  419. return ZERO_SIZE_PTR;
  420. m = slob_alloc(size + align, gfp, align, node);
  421. if (!m)
  422. return NULL;
  423. *m = size;
  424. ret = (void *)m + align;
  425. kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC,
  426. _RET_IP_, ret,
  427. size, size + align, gfp, node);
  428. } else {
  429. unsigned int order = get_order(size);
  430. ret = slob_new_page(gfp | __GFP_COMP, order, node);
  431. if (ret) {
  432. struct page *page;
  433. page = virt_to_page(ret);
  434. page->private = size;
  435. }
  436. kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_KMALLOC,
  437. _RET_IP_, ret,
  438. size, PAGE_SIZE << order, gfp, node);
  439. }
  440. return ret;
  441. }
  442. EXPORT_SYMBOL(__kmalloc_node);
  443. void kfree(const void *block)
  444. {
  445. struct slob_page *sp;
  446. if (unlikely(ZERO_OR_NULL_PTR(block)))
  447. return;
  448. sp = (struct slob_page *)virt_to_page(block);
  449. if (slob_page(sp)) {
  450. int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
  451. unsigned int *m = (unsigned int *)(block - align);
  452. slob_free(m, *m + align);
  453. } else
  454. put_page(&sp->page);
  455. kmemtrace_mark_free(KMEMTRACE_TYPE_KMALLOC, _RET_IP_, block);
  456. }
  457. EXPORT_SYMBOL(kfree);
  458. /* can't use ksize for kmem_cache_alloc memory, only kmalloc */
  459. size_t ksize(const void *block)
  460. {
  461. struct slob_page *sp;
  462. BUG_ON(!block);
  463. if (unlikely(block == ZERO_SIZE_PTR))
  464. return 0;
  465. sp = (struct slob_page *)virt_to_page(block);
  466. if (slob_page(sp)) {
  467. int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
  468. unsigned int *m = (unsigned int *)(block - align);
  469. return SLOB_UNITS(*m) * SLOB_UNIT;
  470. } else
  471. return sp->page.private;
  472. }
  473. EXPORT_SYMBOL(ksize);
  474. struct kmem_cache {
  475. unsigned int size, align;
  476. unsigned long flags;
  477. const char *name;
  478. void (*ctor)(void *);
  479. };
  480. struct kmem_cache *kmem_cache_create(const char *name, size_t size,
  481. size_t align, unsigned long flags, void (*ctor)(void *))
  482. {
  483. struct kmem_cache *c;
  484. c = slob_alloc(sizeof(struct kmem_cache),
  485. GFP_KERNEL, ARCH_KMALLOC_MINALIGN, -1);
  486. if (c) {
  487. c->name = name;
  488. c->size = size;
  489. if (flags & SLAB_DESTROY_BY_RCU) {
  490. /* leave room for rcu footer at the end of object */
  491. c->size += sizeof(struct slob_rcu);
  492. }
  493. c->flags = flags;
  494. c->ctor = ctor;
  495. /* ignore alignment unless it's forced */
  496. c->align = (flags & SLAB_HWCACHE_ALIGN) ? SLOB_ALIGN : 0;
  497. if (c->align < ARCH_SLAB_MINALIGN)
  498. c->align = ARCH_SLAB_MINALIGN;
  499. if (c->align < align)
  500. c->align = align;
  501. } else if (flags & SLAB_PANIC)
  502. panic("Cannot create slab cache %s\n", name);
  503. return c;
  504. }
  505. EXPORT_SYMBOL(kmem_cache_create);
  506. void kmem_cache_destroy(struct kmem_cache *c)
  507. {
  508. slob_free(c, sizeof(struct kmem_cache));
  509. }
  510. EXPORT_SYMBOL(kmem_cache_destroy);
  511. void *kmem_cache_alloc_node(struct kmem_cache *c, gfp_t flags, int node)
  512. {
  513. void *b;
  514. if (c->size < PAGE_SIZE) {
  515. b = slob_alloc(c->size, flags, c->align, node);
  516. kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_CACHE,
  517. _RET_IP_, b, c->size,
  518. SLOB_UNITS(c->size) * SLOB_UNIT,
  519. flags, node);
  520. } else {
  521. b = slob_new_page(flags, get_order(c->size), node);
  522. kmemtrace_mark_alloc_node(KMEMTRACE_TYPE_CACHE,
  523. _RET_IP_, b, c->size,
  524. PAGE_SIZE << get_order(c->size),
  525. flags, node);
  526. }
  527. if (c->ctor)
  528. c->ctor(b);
  529. return b;
  530. }
  531. EXPORT_SYMBOL(kmem_cache_alloc_node);
  532. static void __kmem_cache_free(void *b, int size)
  533. {
  534. if (size < PAGE_SIZE)
  535. slob_free(b, size);
  536. else
  537. free_pages((unsigned long)b, get_order(size));
  538. }
  539. static void kmem_rcu_free(struct rcu_head *head)
  540. {
  541. struct slob_rcu *slob_rcu = (struct slob_rcu *)head;
  542. void *b = (void *)slob_rcu - (slob_rcu->size - sizeof(struct slob_rcu));
  543. __kmem_cache_free(b, slob_rcu->size);
  544. }
  545. void kmem_cache_free(struct kmem_cache *c, void *b)
  546. {
  547. if (unlikely(c->flags & SLAB_DESTROY_BY_RCU)) {
  548. struct slob_rcu *slob_rcu;
  549. slob_rcu = b + (c->size - sizeof(struct slob_rcu));
  550. INIT_RCU_HEAD(&slob_rcu->head);
  551. slob_rcu->size = c->size;
  552. call_rcu(&slob_rcu->head, kmem_rcu_free);
  553. } else {
  554. __kmem_cache_free(b, c->size);
  555. }
  556. kmemtrace_mark_free(KMEMTRACE_TYPE_CACHE, _RET_IP_, b);
  557. }
  558. EXPORT_SYMBOL(kmem_cache_free);
  559. unsigned int kmem_cache_size(struct kmem_cache *c)
  560. {
  561. return c->size;
  562. }
  563. EXPORT_SYMBOL(kmem_cache_size);
  564. const char *kmem_cache_name(struct kmem_cache *c)
  565. {
  566. return c->name;
  567. }
  568. EXPORT_SYMBOL(kmem_cache_name);
  569. int kmem_cache_shrink(struct kmem_cache *d)
  570. {
  571. return 0;
  572. }
  573. EXPORT_SYMBOL(kmem_cache_shrink);
  574. int kmem_ptr_validate(struct kmem_cache *a, const void *b)
  575. {
  576. return 0;
  577. }
  578. static unsigned int slob_ready __read_mostly;
  579. int slab_is_available(void)
  580. {
  581. return slob_ready;
  582. }
  583. void __init kmem_cache_init(void)
  584. {
  585. slob_ready = 1;
  586. }