diff options
| author | Ingo Molnar <mingo@kernel.org> | 2013-12-17 09:27:08 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2013-12-17 09:27:08 -0500 |
| commit | bb799d3b980eb803ca2da4a4eefbd9308f8d988a (patch) | |
| tree | 69fbe0cd6d47b23a50f5e1d87bf7489532fae149 /include/linux/slab.h | |
| parent | 919fc6e34831d1c2b58bfb5ae261dc3facc9b269 (diff) | |
| parent | 319e2e3f63c348a9b66db4667efa73178e18b17d (diff) | |
Merge tag 'v3.13-rc4' into core/locking
Merge Linux 3.13-rc4, to refresh this rather old tree with the latest fixes.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/slab.h')
| -rw-r--r-- | include/linux/slab.h | 111 |
1 files changed, 54 insertions, 57 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h index 74f105847d13..1e2f4fe12773 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
| @@ -53,7 +53,14 @@ | |||
| 53 | * } | 53 | * } |
| 54 | * rcu_read_unlock(); | 54 | * rcu_read_unlock(); |
| 55 | * | 55 | * |
| 56 | * See also the comment on struct slab_rcu in mm/slab.c. | 56 | * This is useful if we need to approach a kernel structure obliquely, |
| 57 | * from its address obtained without the usual locking. We can lock | ||
| 58 | * the structure to stabilize it and check it's still at the given address, | ||
| 59 | * only if we can be sure that the memory has not been meanwhile reused | ||
| 60 | * for some other kind of object (which our subsystem's lock might corrupt). | ||
| 61 | * | ||
| 62 | * rcu_read_lock before reading the address, then rcu_read_unlock after | ||
| 63 | * taking the spinlock within the structure expected at that address. | ||
| 57 | */ | 64 | */ |
| 58 | #define SLAB_DESTROY_BY_RCU 0x00080000UL /* Defer freeing slabs to RCU */ | 65 | #define SLAB_DESTROY_BY_RCU 0x00080000UL /* Defer freeing slabs to RCU */ |
| 59 | #define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ | 66 | #define SLAB_MEM_SPREAD 0x00100000UL /* Spread some memory over cpuset */ |
| @@ -381,10 +388,55 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags) | |||
| 381 | /** | 388 | /** |
| 382 | * kmalloc - allocate memory | 389 | * kmalloc - allocate memory |
| 383 | * @size: how many bytes of memory are required. | 390 | * @size: how many bytes of memory are required. |
| 384 | * @flags: the type of memory to allocate (see kcalloc). | 391 | * @flags: the type of memory to allocate. |
| 385 | * | 392 | * |
| 386 | * kmalloc is the normal method of allocating memory | 393 | * kmalloc is the normal method of allocating memory |
| 387 | * 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. | ||
| 388 | */ | 440 | */ |
| 389 | static __always_inline void *kmalloc(size_t size, gfp_t flags) | 441 | static __always_inline void *kmalloc(size_t size, gfp_t flags) |
| 390 | { | 442 | { |
| @@ -495,61 +547,6 @@ int cache_show(struct kmem_cache *s, struct seq_file *m); | |||
| 495 | void print_slabinfo_header(struct seq_file *m); | 547 | void print_slabinfo_header(struct seq_file *m); |
| 496 | 548 | ||
| 497 | /** | 549 | /** |
| 498 | * kmalloc - allocate memory | ||
| 499 | * @size: how many bytes of memory are required. | ||
| 500 | * @flags: the type of memory to allocate. | ||
| 501 | * | ||
| 502 | * The @flags argument may be one of: | ||
| 503 | * | ||
| 504 | * %GFP_USER - Allocate memory on behalf of user. May sleep. | ||
| 505 | * | ||
| 506 | * %GFP_KERNEL - Allocate normal kernel ram. May sleep. | ||
| 507 | * | ||
| 508 | * %GFP_ATOMIC - Allocation will not sleep. May use emergency pools. | ||
| 509 | * For example, use this inside interrupt handlers. | ||
| 510 | * | ||
| 511 | * %GFP_HIGHUSER - Allocate pages from high memory. | ||
| 512 | * | ||
| 513 | * %GFP_NOIO - Do not do any I/O at all while trying to get memory. | ||
| 514 | * | ||
| 515 | * %GFP_NOFS - Do not make any fs calls while trying to get memory. | ||
| 516 | * | ||
| 517 | * %GFP_NOWAIT - Allocation will not sleep. | ||
| 518 | * | ||
| 519 | * %GFP_THISNODE - Allocate node-local memory only. | ||
| 520 | * | ||
| 521 | * %GFP_DMA - Allocation suitable for DMA. | ||
| 522 | * Should only be used for kmalloc() caches. Otherwise, use a | ||
| 523 | * slab created with SLAB_DMA. | ||
| 524 | * | ||
| 525 | * Also it is possible to set different flags by OR'ing | ||
| 526 | * in one or more of the following additional @flags: | ||
| 527 | * | ||
| 528 | * %__GFP_COLD - Request cache-cold pages instead of | ||
| 529 | * trying to return cache-warm pages. | ||
| 530 | * | ||
| 531 | * %__GFP_HIGH - This allocation has high priority and may use emergency pools. | ||
| 532 | * | ||
| 533 | * %__GFP_NOFAIL - Indicate that this allocation is in no way allowed to fail | ||
| 534 | * (think twice before using). | ||
| 535 | * | ||
| 536 | * %__GFP_NORETRY - If memory is not immediately available, | ||
| 537 | * then give up at once. | ||
| 538 | * | ||
| 539 | * %__GFP_NOWARN - If allocation fails, don't issue any warnings. | ||
| 540 | * | ||
| 541 | * %__GFP_REPEAT - If allocation fails initially, try once more before failing. | ||
| 542 | * | ||
| 543 | * There are other flags available as well, but these are not intended | ||
| 544 | * for general use, and so are not documented here. For a full list of | ||
| 545 | * potential flags, always refer to linux/gfp.h. | ||
| 546 | * | ||
| 547 | * kmalloc is the normal method of allocating memory | ||
| 548 | * in the kernel. | ||
| 549 | */ | ||
| 550 | static __always_inline void *kmalloc(size_t size, gfp_t flags); | ||
| 551 | |||
| 552 | /** | ||
| 553 | * kmalloc_array - allocate memory for an array. | 550 | * kmalloc_array - allocate memory for an array. |
| 554 | * @n: number of elements. | 551 | * @n: number of elements. |
| 555 | * @size: element size. | 552 | * @size: element size. |
