slab_common.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. /*
  2. * Slab allocator functions that are independent of the allocator strategy
  3. *
  4. * (C) 2012 Christoph Lameter <cl@linux.com>
  5. */
  6. #include <linux/slab.h>
  7. #include <linux/mm.h>
  8. #include <linux/poison.h>
  9. #include <linux/interrupt.h>
  10. #include <linux/memory.h>
  11. #include <linux/compiler.h>
  12. #include <linux/module.h>
  13. #include <linux/cpu.h>
  14. #include <linux/uaccess.h>
  15. #include <linux/seq_file.h>
  16. #include <linux/proc_fs.h>
  17. #include <asm/cacheflush.h>
  18. #include <asm/tlbflush.h>
  19. #include <asm/page.h>
  20. #include <linux/memcontrol.h>
  21. #include <trace/events/kmem.h>
  22. #include "slab.h"
  23. enum slab_state slab_state;
  24. LIST_HEAD(slab_caches);
  25. DEFINE_MUTEX(slab_mutex);
  26. struct kmem_cache *kmem_cache;
  27. #ifdef CONFIG_DEBUG_VM
  28. static int kmem_cache_sanity_check(struct mem_cgroup *memcg, const char *name,
  29. size_t size)
  30. {
  31. struct kmem_cache *s = NULL;
  32. if (!name || in_interrupt() || size < sizeof(void *) ||
  33. size > KMALLOC_MAX_SIZE) {
  34. pr_err("kmem_cache_create(%s) integrity check failed\n", name);
  35. return -EINVAL;
  36. }
  37. list_for_each_entry(s, &slab_caches, list) {
  38. char tmp;
  39. int res;
  40. /*
  41. * This happens when the module gets unloaded and doesn't
  42. * destroy its slab cache and no-one else reuses the vmalloc
  43. * area of the module. Print a warning.
  44. */
  45. res = probe_kernel_address(s->name, tmp);
  46. if (res) {
  47. pr_err("Slab cache with size %d has lost its name\n",
  48. s->object_size);
  49. continue;
  50. }
  51. #if !defined(CONFIG_SLUB) || !defined(CONFIG_SLUB_DEBUG_ON)
  52. /*
  53. * For simplicity, we won't check this in the list of memcg
  54. * caches. We have control over memcg naming, and if there
  55. * aren't duplicates in the global list, there won't be any
  56. * duplicates in the memcg lists as well.
  57. */
  58. if (!memcg && !strcmp(s->name, name)) {
  59. pr_err("%s (%s): Cache name already exists.\n",
  60. __func__, name);
  61. dump_stack();
  62. s = NULL;
  63. return -EINVAL;
  64. }
  65. #endif
  66. }
  67. WARN_ON(strchr(name, ' ')); /* It confuses parsers */
  68. return 0;
  69. }
  70. #else
  71. static inline int kmem_cache_sanity_check(struct mem_cgroup *memcg,
  72. const char *name, size_t size)
  73. {
  74. return 0;
  75. }
  76. #endif
  77. #ifdef CONFIG_MEMCG_KMEM
  78. int memcg_update_all_caches(int num_memcgs)
  79. {
  80. struct kmem_cache *s;
  81. int ret = 0;
  82. mutex_lock(&slab_mutex);
  83. list_for_each_entry(s, &slab_caches, list) {
  84. if (!is_root_cache(s))
  85. continue;
  86. ret = memcg_update_cache_size(s, num_memcgs);
  87. /*
  88. * See comment in memcontrol.c, memcg_update_cache_size:
  89. * Instead of freeing the memory, we'll just leave the caches
  90. * up to this point in an updated state.
  91. */
  92. if (ret)
  93. goto out;
  94. }
  95. memcg_update_array_size(num_memcgs);
  96. out:
  97. mutex_unlock(&slab_mutex);
  98. return ret;
  99. }
  100. #endif
  101. /*
  102. * Figure out what the alignment of the objects will be given a set of
  103. * flags, a user specified alignment and the size of the objects.
  104. */
  105. unsigned long calculate_alignment(unsigned long flags,
  106. unsigned long align, unsigned long size)
  107. {
  108. /*
  109. * If the user wants hardware cache aligned objects then follow that
  110. * suggestion if the object is sufficiently large.
  111. *
  112. * The hardware cache alignment cannot override the specified
  113. * alignment though. If that is greater then use it.
  114. */
  115. if (flags & SLAB_HWCACHE_ALIGN) {
  116. unsigned long ralign = cache_line_size();
  117. while (size <= ralign / 2)
  118. ralign /= 2;
  119. align = max(align, ralign);
  120. }
  121. if (align < ARCH_SLAB_MINALIGN)
  122. align = ARCH_SLAB_MINALIGN;
  123. return ALIGN(align, sizeof(void *));
  124. }
  125. /*
  126. * kmem_cache_create - Create a cache.
  127. * @name: A string which is used in /proc/slabinfo to identify this cache.
  128. * @size: The size of objects to be created in this cache.
  129. * @align: The required alignment for the objects.
  130. * @flags: SLAB flags
  131. * @ctor: A constructor for the objects.
  132. *
  133. * Returns a ptr to the cache on success, NULL on failure.
  134. * Cannot be called within a interrupt, but can be interrupted.
  135. * The @ctor is run when new pages are allocated by the cache.
  136. *
  137. * The flags are
  138. *
  139. * %SLAB_POISON - Poison the slab with a known test pattern (a5a5a5a5)
  140. * to catch references to uninitialised memory.
  141. *
  142. * %SLAB_RED_ZONE - Insert `Red' zones around the allocated memory to check
  143. * for buffer overruns.
  144. *
  145. * %SLAB_HWCACHE_ALIGN - Align the objects in this cache to a hardware
  146. * cacheline. This can be beneficial if you're counting cycles as closely
  147. * as davem.
  148. */
  149. struct kmem_cache *
  150. kmem_cache_create_memcg(struct mem_cgroup *memcg, const char *name, size_t size,
  151. size_t align, unsigned long flags, void (*ctor)(void *),
  152. struct kmem_cache *parent_cache)
  153. {
  154. struct kmem_cache *s = NULL;
  155. int err;
  156. get_online_cpus();
  157. mutex_lock(&slab_mutex);
  158. err = kmem_cache_sanity_check(memcg, name, size);
  159. if (err)
  160. goto out_unlock;
  161. if (memcg) {
  162. /*
  163. * Since per-memcg caches are created asynchronously on first
  164. * allocation (see memcg_kmem_get_cache()), several threads can
  165. * try to create the same cache, but only one of them may
  166. * succeed. Therefore if we get here and see the cache has
  167. * already been created, we silently return NULL.
  168. */
  169. if (cache_from_memcg_idx(parent_cache, memcg_cache_id(memcg)))
  170. goto out_unlock;
  171. }
  172. /*
  173. * Some allocators will constraint the set of valid flags to a subset
  174. * of all flags. We expect them to define CACHE_CREATE_MASK in this
  175. * case, and we'll just provide them with a sanitized version of the
  176. * passed flags.
  177. */
  178. flags &= CACHE_CREATE_MASK;
  179. s = __kmem_cache_alias(memcg, name, size, align, flags, ctor);
  180. if (s)
  181. goto out_unlock;
  182. err = -ENOMEM;
  183. s = kmem_cache_zalloc(kmem_cache, GFP_KERNEL);
  184. if (!s)
  185. goto out_unlock;
  186. s->object_size = s->size = size;
  187. s->align = calculate_alignment(flags, align, size);
  188. s->ctor = ctor;
  189. s->name = kstrdup(name, GFP_KERNEL);
  190. if (!s->name)
  191. goto out_free_cache;
  192. err = memcg_alloc_cache_params(memcg, s, parent_cache);
  193. if (err)
  194. goto out_free_cache;
  195. err = __kmem_cache_create(s, flags);
  196. if (err)
  197. goto out_free_cache;
  198. s->refcount = 1;
  199. list_add(&s->list, &slab_caches);
  200. memcg_register_cache(s);
  201. out_unlock:
  202. mutex_unlock(&slab_mutex);
  203. put_online_cpus();
  204. if (err) {
  205. /*
  206. * There is no point in flooding logs with warnings or
  207. * especially crashing the system if we fail to create a cache
  208. * for a memcg. In this case we will be accounting the memcg
  209. * allocation to the root cgroup until we succeed to create its
  210. * own cache, but it isn't that critical.
  211. */
  212. if (!memcg)
  213. return NULL;
  214. if (flags & SLAB_PANIC)
  215. panic("kmem_cache_create: Failed to create slab '%s'. Error %d\n",
  216. name, err);
  217. else {
  218. printk(KERN_WARNING "kmem_cache_create(%s) failed with error %d",
  219. name, err);
  220. dump_stack();
  221. }
  222. return NULL;
  223. }
  224. return s;
  225. out_free_cache:
  226. memcg_free_cache_params(s);
  227. kfree(s->name);
  228. kmem_cache_free(kmem_cache, s);
  229. goto out_unlock;
  230. }
  231. struct kmem_cache *
  232. kmem_cache_create(const char *name, size_t size, size_t align,
  233. unsigned long flags, void (*ctor)(void *))
  234. {
  235. return kmem_cache_create_memcg(NULL, name, size, align, flags, ctor, NULL);
  236. }
  237. EXPORT_SYMBOL(kmem_cache_create);
  238. void kmem_cache_destroy(struct kmem_cache *s)
  239. {
  240. /* Destroy all the children caches if we aren't a memcg cache */
  241. kmem_cache_destroy_memcg_children(s);
  242. get_online_cpus();
  243. mutex_lock(&slab_mutex);
  244. s->refcount--;
  245. if (!s->refcount) {
  246. list_del(&s->list);
  247. if (!__kmem_cache_shutdown(s)) {
  248. memcg_unregister_cache(s);
  249. mutex_unlock(&slab_mutex);
  250. if (s->flags & SLAB_DESTROY_BY_RCU)
  251. rcu_barrier();
  252. memcg_free_cache_params(s);
  253. kfree(s->name);
  254. kmem_cache_free(kmem_cache, s);
  255. } else {
  256. list_add(&s->list, &slab_caches);
  257. mutex_unlock(&slab_mutex);
  258. printk(KERN_ERR "kmem_cache_destroy %s: Slab cache still has objects\n",
  259. s->name);
  260. dump_stack();
  261. }
  262. } else {
  263. mutex_unlock(&slab_mutex);
  264. }
  265. put_online_cpus();
  266. }
  267. EXPORT_SYMBOL(kmem_cache_destroy);
  268. int slab_is_available(void)
  269. {
  270. return slab_state >= UP;
  271. }
  272. #ifndef CONFIG_SLOB
  273. /* Create a cache during boot when no slab services are available yet */
  274. void __init create_boot_cache(struct kmem_cache *s, const char *name, size_t size,
  275. unsigned long flags)
  276. {
  277. int err;
  278. s->name = name;
  279. s->size = s->object_size = size;
  280. s->align = calculate_alignment(flags, ARCH_KMALLOC_MINALIGN, size);
  281. err = __kmem_cache_create(s, flags);
  282. if (err)
  283. panic("Creation of kmalloc slab %s size=%zu failed. Reason %d\n",
  284. name, size, err);
  285. s->refcount = -1; /* Exempt from merging for now */
  286. }
  287. struct kmem_cache *__init create_kmalloc_cache(const char *name, size_t size,
  288. unsigned long flags)
  289. {
  290. struct kmem_cache *s = kmem_cache_zalloc(kmem_cache, GFP_NOWAIT);
  291. if (!s)
  292. panic("Out of memory when creating slab %s\n", name);
  293. create_boot_cache(s, name, size, flags);
  294. list_add(&s->list, &slab_caches);
  295. s->refcount = 1;
  296. return s;
  297. }
  298. struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1];
  299. EXPORT_SYMBOL(kmalloc_caches);
  300. #ifdef CONFIG_ZONE_DMA
  301. struct kmem_cache *kmalloc_dma_caches[KMALLOC_SHIFT_HIGH + 1];
  302. EXPORT_SYMBOL(kmalloc_dma_caches);
  303. #endif
  304. /*
  305. * Conversion table for small slabs sizes / 8 to the index in the
  306. * kmalloc array. This is necessary for slabs < 192 since we have non power
  307. * of two cache sizes there. The size of larger slabs can be determined using
  308. * fls.
  309. */
  310. static s8 size_index[24] = {
  311. 3, /* 8 */
  312. 4, /* 16 */
  313. 5, /* 24 */
  314. 5, /* 32 */
  315. 6, /* 40 */
  316. 6, /* 48 */
  317. 6, /* 56 */
  318. 6, /* 64 */
  319. 1, /* 72 */
  320. 1, /* 80 */
  321. 1, /* 88 */
  322. 1, /* 96 */
  323. 7, /* 104 */
  324. 7, /* 112 */
  325. 7, /* 120 */
  326. 7, /* 128 */
  327. 2, /* 136 */
  328. 2, /* 144 */
  329. 2, /* 152 */
  330. 2, /* 160 */
  331. 2, /* 168 */
  332. 2, /* 176 */
  333. 2, /* 184 */
  334. 2 /* 192 */
  335. };
  336. static inline int size_index_elem(size_t bytes)
  337. {
  338. return (bytes - 1) / 8;
  339. }
  340. /*
  341. * Find the kmem_cache structure that serves a given size of
  342. * allocation
  343. */
  344. struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags)
  345. {
  346. int index;
  347. if (unlikely(size > KMALLOC_MAX_SIZE)) {
  348. WARN_ON_ONCE(!(flags & __GFP_NOWARN));
  349. return NULL;
  350. }
  351. if (size <= 192) {
  352. if (!size)
  353. return ZERO_SIZE_PTR;
  354. index = size_index[size_index_elem(size)];
  355. } else
  356. index = fls(size - 1);
  357. #ifdef CONFIG_ZONE_DMA
  358. if (unlikely((flags & GFP_DMA)))
  359. return kmalloc_dma_caches[index];
  360. #endif
  361. return kmalloc_caches[index];
  362. }
  363. /*
  364. * Create the kmalloc array. Some of the regular kmalloc arrays
  365. * may already have been created because they were needed to
  366. * enable allocations for slab creation.
  367. */
  368. void __init create_kmalloc_caches(unsigned long flags)
  369. {
  370. int i;
  371. /*
  372. * Patch up the size_index table if we have strange large alignment
  373. * requirements for the kmalloc array. This is only the case for
  374. * MIPS it seems. The standard arches will not generate any code here.
  375. *
  376. * Largest permitted alignment is 256 bytes due to the way we
  377. * handle the index determination for the smaller caches.
  378. *
  379. * Make sure that nothing crazy happens if someone starts tinkering
  380. * around with ARCH_KMALLOC_MINALIGN
  381. */
  382. BUILD_BUG_ON(KMALLOC_MIN_SIZE > 256 ||
  383. (KMALLOC_MIN_SIZE & (KMALLOC_MIN_SIZE - 1)));
  384. for (i = 8; i < KMALLOC_MIN_SIZE; i += 8) {
  385. int elem = size_index_elem(i);
  386. if (elem >= ARRAY_SIZE(size_index))
  387. break;
  388. size_index[elem] = KMALLOC_SHIFT_LOW;
  389. }
  390. if (KMALLOC_MIN_SIZE >= 64) {
  391. /*
  392. * The 96 byte size cache is not used if the alignment
  393. * is 64 byte.
  394. */
  395. for (i = 64 + 8; i <= 96; i += 8)
  396. size_index[size_index_elem(i)] = 7;
  397. }
  398. if (KMALLOC_MIN_SIZE >= 128) {
  399. /*
  400. * The 192 byte sized cache is not used if the alignment
  401. * is 128 byte. Redirect kmalloc to use the 256 byte cache
  402. * instead.
  403. */
  404. for (i = 128 + 8; i <= 192; i += 8)
  405. size_index[size_index_elem(i)] = 8;
  406. }
  407. for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) {
  408. if (!kmalloc_caches[i]) {
  409. kmalloc_caches[i] = create_kmalloc_cache(NULL,
  410. 1 << i, flags);
  411. }
  412. /*
  413. * Caches that are not of the two-to-the-power-of size.
  414. * These have to be created immediately after the
  415. * earlier power of two caches
  416. */
  417. if (KMALLOC_MIN_SIZE <= 32 && !kmalloc_caches[1] && i == 6)
  418. kmalloc_caches[1] = create_kmalloc_cache(NULL, 96, flags);
  419. if (KMALLOC_MIN_SIZE <= 64 && !kmalloc_caches[2] && i == 7)
  420. kmalloc_caches[2] = create_kmalloc_cache(NULL, 192, flags);
  421. }
  422. /* Kmalloc array is now usable */
  423. slab_state = UP;
  424. for (i = 0; i <= KMALLOC_SHIFT_HIGH; i++) {
  425. struct kmem_cache *s = kmalloc_caches[i];
  426. char *n;
  427. if (s) {
  428. n = kasprintf(GFP_NOWAIT, "kmalloc-%d", kmalloc_size(i));
  429. BUG_ON(!n);
  430. s->name = n;
  431. }
  432. }
  433. #ifdef CONFIG_ZONE_DMA
  434. for (i = 0; i <= KMALLOC_SHIFT_HIGH; i++) {
  435. struct kmem_cache *s = kmalloc_caches[i];
  436. if (s) {
  437. int size = kmalloc_size(i);
  438. char *n = kasprintf(GFP_NOWAIT,
  439. "dma-kmalloc-%d", size);
  440. BUG_ON(!n);
  441. kmalloc_dma_caches[i] = create_kmalloc_cache(n,
  442. size, SLAB_CACHE_DMA | flags);
  443. }
  444. }
  445. #endif
  446. }
  447. #endif /* !CONFIG_SLOB */
  448. #ifdef CONFIG_TRACING
  449. void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order)
  450. {
  451. void *ret = kmalloc_order(size, flags, order);
  452. trace_kmalloc(_RET_IP_, ret, size, PAGE_SIZE << order, flags);
  453. return ret;
  454. }
  455. EXPORT_SYMBOL(kmalloc_order_trace);
  456. #endif
  457. #ifdef CONFIG_SLABINFO
  458. #ifdef CONFIG_SLAB
  459. #define SLABINFO_RIGHTS (S_IWUSR | S_IRUSR)
  460. #else
  461. #define SLABINFO_RIGHTS S_IRUSR
  462. #endif
  463. void print_slabinfo_header(struct seq_file *m)
  464. {
  465. /*
  466. * Output format version, so at least we can change it
  467. * without _too_ many complaints.
  468. */
  469. #ifdef CONFIG_DEBUG_SLAB
  470. seq_puts(m, "slabinfo - version: 2.1 (statistics)\n");
  471. #else
  472. seq_puts(m, "slabinfo - version: 2.1\n");
  473. #endif
  474. seq_puts(m, "# name <active_objs> <num_objs> <objsize> "
  475. "<objperslab> <pagesperslab>");
  476. seq_puts(m, " : tunables <limit> <batchcount> <sharedfactor>");
  477. seq_puts(m, " : slabdata <active_slabs> <num_slabs> <sharedavail>");
  478. #ifdef CONFIG_DEBUG_SLAB
  479. seq_puts(m, " : globalstat <listallocs> <maxobjs> <grown> <reaped> "
  480. "<error> <maxfreeable> <nodeallocs> <remotefrees> <alienoverflow>");
  481. seq_puts(m, " : cpustat <allochit> <allocmiss> <freehit> <freemiss>");
  482. #endif
  483. seq_putc(m, '\n');
  484. }
  485. static void *s_start(struct seq_file *m, loff_t *pos)
  486. {
  487. loff_t n = *pos;
  488. mutex_lock(&slab_mutex);
  489. if (!n)
  490. print_slabinfo_header(m);
  491. return seq_list_start(&slab_caches, *pos);
  492. }
  493. void *slab_next(struct seq_file *m, void *p, loff_t *pos)
  494. {
  495. return seq_list_next(p, &slab_caches, pos);
  496. }
  497. void slab_stop(struct seq_file *m, void *p)
  498. {
  499. mutex_unlock(&slab_mutex);
  500. }
  501. static void
  502. memcg_accumulate_slabinfo(struct kmem_cache *s, struct slabinfo *info)
  503. {
  504. struct kmem_cache *c;
  505. struct slabinfo sinfo;
  506. int i;
  507. if (!is_root_cache(s))
  508. return;
  509. for_each_memcg_cache_index(i) {
  510. c = cache_from_memcg_idx(s, i);
  511. if (!c)
  512. continue;
  513. memset(&sinfo, 0, sizeof(sinfo));
  514. get_slabinfo(c, &sinfo);
  515. info->active_slabs += sinfo.active_slabs;
  516. info->num_slabs += sinfo.num_slabs;
  517. info->shared_avail += sinfo.shared_avail;
  518. info->active_objs += sinfo.active_objs;
  519. info->num_objs += sinfo.num_objs;
  520. }
  521. }
  522. int cache_show(struct kmem_cache *s, struct seq_file *m)
  523. {
  524. struct slabinfo sinfo;
  525. memset(&sinfo, 0, sizeof(sinfo));
  526. get_slabinfo(s, &sinfo);
  527. memcg_accumulate_slabinfo(s, &sinfo);
  528. seq_printf(m, "%-17s %6lu %6lu %6u %4u %4d",
  529. cache_name(s), sinfo.active_objs, sinfo.num_objs, s->size,
  530. sinfo.objects_per_slab, (1 << sinfo.cache_order));
  531. seq_printf(m, " : tunables %4u %4u %4u",
  532. sinfo.limit, sinfo.batchcount, sinfo.shared);
  533. seq_printf(m, " : slabdata %6lu %6lu %6lu",
  534. sinfo.active_slabs, sinfo.num_slabs, sinfo.shared_avail);
  535. slabinfo_show_stats(m, s);
  536. seq_putc(m, '\n');
  537. return 0;
  538. }
  539. static int s_show(struct seq_file *m, void *p)
  540. {
  541. struct kmem_cache *s = list_entry(p, struct kmem_cache, list);
  542. if (!is_root_cache(s))
  543. return 0;
  544. return cache_show(s, m);
  545. }
  546. /*
  547. * slabinfo_op - iterator that generates /proc/slabinfo
  548. *
  549. * Output layout:
  550. * cache-name
  551. * num-active-objs
  552. * total-objs
  553. * object size
  554. * num-active-slabs
  555. * total-slabs
  556. * num-pages-per-slab
  557. * + further values on SMP and with statistics enabled
  558. */
  559. static const struct seq_operations slabinfo_op = {
  560. .start = s_start,
  561. .next = slab_next,
  562. .stop = slab_stop,
  563. .show = s_show,
  564. };
  565. static int slabinfo_open(struct inode *inode, struct file *file)
  566. {
  567. return seq_open(file, &slabinfo_op);
  568. }
  569. static const struct file_operations proc_slabinfo_operations = {
  570. .open = slabinfo_open,
  571. .read = seq_read,
  572. .write = slabinfo_write,
  573. .llseek = seq_lseek,
  574. .release = seq_release,
  575. };
  576. static int __init slab_proc_init(void)
  577. {
  578. proc_create("slabinfo", SLABINFO_RIGHTS, NULL,
  579. &proc_slabinfo_operations);
  580. return 0;
  581. }
  582. module_init(slab_proc_init);
  583. #endif /* CONFIG_SLABINFO */