aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/slab.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/slab.h')
-rw-r--r--include/linux/slab.h102
1 files changed, 46 insertions, 56 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h
index c2bba248fa63..1e2f4fe12773 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -388,10 +388,55 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
388/** 388/**
389 * kmalloc - allocate memory 389 * kmalloc - allocate memory
390 * @size: how many bytes of memory are required. 390 * @size: how many bytes of memory are required.
391 * @flags: the type of memory to allocate (see kcalloc). 391 * @flags: the type of memory to allocate.
392 * 392 *
393 * kmalloc is the normal method of allocating memory 393 * kmalloc is the normal method of allocating memory
394 * for objects smaller than page size in the kernel. 394 * for objects smaller than page size in the kernel.
395 *
396 * The @flags argument may be one of:
397 *
398 * %GFP_USER - Allocate memory on behalf of user. May sleep.
399 *
400 * %GFP_KERNEL - Allocate normal kernel ram. May sleep.
401 *
402 * %GFP_ATOMIC - Allocation will not sleep. May use emergency pools.
403 * For example, use this inside interrupt handlers.
404 *
405 * %GFP_HIGHUSER - Allocate pages from high memory.
406 *
407 * %GFP_NOIO - Do not do any I/O at all while trying to get memory.
408 *
409 * %GFP_NOFS - Do not make any fs calls while trying to get memory.
410 *
411 * %GFP_NOWAIT - Allocation will not sleep.
412 *
413 * %GFP_THISNODE - Allocate node-local memory only.
414 *
415 * %GFP_DMA - Allocation suitable for DMA.
416 * Should only be used for kmalloc() caches. Otherwise, use a
417 * slab created with SLAB_DMA.
418 *
419 * Also it is possible to set different flags by OR'ing
420 * in one or more of the following additional @flags:
421 *
422 * %__GFP_COLD - Request cache-cold pages instead of
423 * trying to return cache-warm pages.
424 *
425 * %__GFP_HIGH - This allocation has high priority and may use emergency pools.
426 *
427 * %__GFP_NOFAIL - Indicate that this allocation is in no way allowed to fail
428 * (think twice before using).
429 *
430 * %__GFP_NORETRY - If memory is not immediately available,
431 * then give up at once.
432 *
433 * %__GFP_NOWARN - If allocation fails, don't issue any warnings.
434 *
435 * %__GFP_REPEAT - If allocation fails initially, try once more before failing.
436 *
437 * There are other flags available as well, but these are not intended
438 * for general use, and so are not documented here. For a full list of
439 * potential flags, always refer to linux/gfp.h.
395 */ 440 */
396static __always_inline void *kmalloc(size_t size, gfp_t flags) 441static __always_inline void *kmalloc(size_t size, gfp_t flags)
397{ 442{
@@ -502,61 +547,6 @@ int cache_show(struct kmem_cache *s, struct seq_file *m);
502void print_slabinfo_header(struct seq_file *m); 547void print_slabinfo_header(struct seq_file *m);
503 548
504/** 549/**
505 * kmalloc - allocate memory
506 * @size: how many bytes of memory are required.
507 * @flags: the type of memory to allocate.
508 *
509 * The @flags argument may be one of:
510 *
511 * %GFP_USER - Allocate memory on behalf of user. May sleep.
512 *
513 * %GFP_KERNEL - Allocate normal kernel ram. May sleep.
514 *
515 * %GFP_ATOMIC - Allocation will not sleep. May use emergency pools.
516 * For example, use this inside interrupt handlers.
517 *
518 * %GFP_HIGHUSER - Allocate pages from high memory.
519 *
520 * %GFP_NOIO - Do not do any I/O at all while trying to get memory.
521 *
522 * %GFP_NOFS - Do not make any fs calls while trying to get memory.
523 *
524 * %GFP_NOWAIT - Allocation will not sleep.
525 *
526 * %GFP_THISNODE - Allocate node-local memory only.
527 *
528 * %GFP_DMA - Allocation suitable for DMA.
529 * Should only be used for kmalloc() caches. Otherwise, use a
530 * slab created with SLAB_DMA.
531 *
532 * Also it is possible to set different flags by OR'ing
533 * in one or more of the following additional @flags:
534 *
535 * %__GFP_COLD - Request cache-cold pages instead of
536 * trying to return cache-warm pages.
537 *
538 * %__GFP_HIGH - This allocation has high priority and may use emergency pools.
539 *
540 * %__GFP_NOFAIL - Indicate that this allocation is in no way allowed to fail
541 * (think twice before using).
542 *
543 * %__GFP_NORETRY - If memory is not immediately available,
544 * then give up at once.
545 *
546 * %__GFP_NOWARN - If allocation fails, don't issue any warnings.
547 *
548 * %__GFP_REPEAT - If allocation fails initially, try once more before failing.
549 *
550 * There are other flags available as well, but these are not intended
551 * for general use, and so are not documented here. For a full list of
552 * potential flags, always refer to linux/gfp.h.
553 *
554 * kmalloc is the normal method of allocating memory
555 * in the kernel.
556 */
557static __always_inline void *kmalloc(size_t size, gfp_t flags);
558
559/**
560 * kmalloc_array - allocate memory for an array. 550 * kmalloc_array - allocate memory for an array.
561 * @n: number of elements. 551 * @n: number of elements.
562 * @size: element size. 552 * @size: element size.