| .. | .. |
|---|
| 23 | 23 | .. kernel-doc:: lib/genalloc.c |
|---|
| 24 | 24 | :functions: devm_gen_pool_create |
|---|
| 25 | 25 | |
|---|
| 26 | | -A call to :c:func:`gen_pool_create` will create a pool. The granularity of |
|---|
| 26 | +A call to gen_pool_create() will create a pool. The granularity of |
|---|
| 27 | 27 | allocations is set with min_alloc_order; it is a log-base-2 number like |
|---|
| 28 | 28 | those used by the page allocator, but it refers to bytes rather than pages. |
|---|
| 29 | 29 | So, if min_alloc_order is passed as 3, then all allocations will be a |
|---|
| .. | .. |
|---|
| 32 | 32 | which NUMA node should be used for the allocation of the housekeeping |
|---|
| 33 | 33 | structures; it can be -1 if the caller doesn't care. |
|---|
| 34 | 34 | |
|---|
| 35 | | -The "managed" interface :c:func:`devm_gen_pool_create` ties the pool to a |
|---|
| 35 | +The "managed" interface devm_gen_pool_create() ties the pool to a |
|---|
| 36 | 36 | specific device. Among other things, it will automatically clean up the |
|---|
| 37 | 37 | pool when the given device is destroyed. |
|---|
| 38 | 38 | |
|---|
| .. | .. |
|---|
| 53 | 53 | :functions: gen_pool_add |
|---|
| 54 | 54 | |
|---|
| 55 | 55 | .. kernel-doc:: lib/genalloc.c |
|---|
| 56 | | - :functions: gen_pool_add_virt |
|---|
| 56 | + :functions: gen_pool_add_owner |
|---|
| 57 | 57 | |
|---|
| 58 | | -A call to :c:func:`gen_pool_add` will place the size bytes of memory |
|---|
| 58 | +A call to gen_pool_add() will place the size bytes of memory |
|---|
| 59 | 59 | starting at addr (in the kernel's virtual address space) into the given |
|---|
| 60 | 60 | pool, once again using nid as the node ID for ancillary memory allocations. |
|---|
| 61 | | -The :c:func:`gen_pool_add_virt` variant associates an explicit physical |
|---|
| 61 | +The gen_pool_add_virt() variant associates an explicit physical |
|---|
| 62 | 62 | address with the memory; this is only necessary if the pool will be used |
|---|
| 63 | 63 | for DMA allocations. |
|---|
| 64 | 64 | |
|---|
| 65 | 65 | The functions for allocating memory from the pool (and putting it back) |
|---|
| 66 | 66 | are: |
|---|
| 67 | 67 | |
|---|
| 68 | | -.. kernel-doc:: lib/genalloc.c |
|---|
| 68 | +.. kernel-doc:: include/linux/genalloc.h |
|---|
| 69 | 69 | :functions: gen_pool_alloc |
|---|
| 70 | 70 | |
|---|
| 71 | 71 | .. kernel-doc:: lib/genalloc.c |
|---|
| 72 | 72 | :functions: gen_pool_dma_alloc |
|---|
| 73 | 73 | |
|---|
| 74 | 74 | .. kernel-doc:: lib/genalloc.c |
|---|
| 75 | | - :functions: gen_pool_free |
|---|
| 75 | + :functions: gen_pool_free_owner |
|---|
| 76 | 76 | |
|---|
| 77 | | -As one would expect, :c:func:`gen_pool_alloc` will allocate size< bytes |
|---|
| 78 | | -from the given pool. The :c:func:`gen_pool_dma_alloc` variant allocates |
|---|
| 77 | +As one would expect, gen_pool_alloc() will allocate size< bytes |
|---|
| 78 | +from the given pool. The gen_pool_dma_alloc() variant allocates |
|---|
| 79 | 79 | memory for use with DMA operations, returning the associated physical |
|---|
| 80 | 80 | address in the space pointed to by dma. This will only work if the memory |
|---|
| 81 | | -was added with :c:func:`gen_pool_add_virt`. Note that this function |
|---|
| 81 | +was added with gen_pool_add_virt(). Note that this function |
|---|
| 82 | 82 | departs from the usual genpool pattern of using unsigned long values to |
|---|
| 83 | 83 | represent kernel addresses; it returns a void * instead. |
|---|
| 84 | 84 | |
|---|
| .. | .. |
|---|
| 89 | 89 | of interest: |
|---|
| 90 | 90 | |
|---|
| 91 | 91 | .. kernel-doc:: lib/genalloc.c |
|---|
| 92 | | - :functions: gen_pool_alloc_algo |
|---|
| 92 | + :functions: gen_pool_alloc_algo_owner |
|---|
| 93 | 93 | |
|---|
| 94 | 94 | .. kernel-doc:: lib/genalloc.c |
|---|
| 95 | 95 | :functions: gen_pool_set_algo |
|---|
| 96 | 96 | |
|---|
| 97 | | -Allocations with :c:func:`gen_pool_alloc_algo` specify an algorithm to be |
|---|
| 97 | +Allocations with gen_pool_alloc_algo() specify an algorithm to be |
|---|
| 98 | 98 | used to choose the memory to be allocated; the default algorithm can be set |
|---|
| 99 | | -with :c:func:`gen_pool_set_algo`. The data value is passed to the |
|---|
| 99 | +with gen_pool_set_algo(). The data value is passed to the |
|---|
| 100 | 100 | algorithm; most ignore it, but it is occasionally needed. One can, |
|---|
| 101 | 101 | naturally, write a special-purpose algorithm, but there is a fair set |
|---|
| 102 | 102 | already available: |
|---|
| .. | .. |
|---|
| 129 | 129 | :functions: gen_pool_for_each_chunk |
|---|
| 130 | 130 | |
|---|
| 131 | 131 | .. kernel-doc:: lib/genalloc.c |
|---|
| 132 | | - :functions: addr_in_gen_pool |
|---|
| 132 | + :functions: gen_pool_has_addr |
|---|
| 133 | 133 | |
|---|
| 134 | 134 | .. kernel-doc:: lib/genalloc.c |
|---|
| 135 | 135 | :functions: gen_pool_avail |
|---|