Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs/core-api: memory-allocation: remove uses of c:func:

These are no longer needed as the documentation build will automatically
add the cross references.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Acked-by: Mike Rapoport <rppt@linux.ibm.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

authored by

Chris Packham and committed by
Jonathan Corbet
094ef1c9 ef8330fe

+22 -25
+22 -25
Documentation/core-api/memory-allocation.rst
··· 88 88 ========================== 89 89 90 90 The most straightforward way to allocate memory is to use a function 91 - from the :c:func:`kmalloc` family. And, to be on the safe side it's 92 - best to use routines that set memory to zero, like 93 - :c:func:`kzalloc`. If you need to allocate memory for an array, there 94 - are :c:func:`kmalloc_array` and :c:func:`kcalloc` helpers. 91 + from the kmalloc() family. And, to be on the safe side it's best to use 92 + routines that set memory to zero, like kzalloc(). If you need to 93 + allocate memory for an array, there are kmalloc_array() and kcalloc() 94 + helpers. 95 95 96 96 The maximal size of a chunk that can be allocated with `kmalloc` is 97 97 limited. The actual limit depends on the hardware and the kernel ··· 102 102 ARCH_KMALLOC_MINALIGN bytes. For sizes which are a power of two, the 103 103 alignment is also guaranteed to be at least the respective size. 104 104 105 - For large allocations you can use :c:func:`vmalloc` and 106 - :c:func:`vzalloc`, or directly request pages from the page 107 - allocator. The memory allocated by `vmalloc` and related functions is 108 - not physically contiguous. 105 + For large allocations you can use vmalloc() and vzalloc(), or directly 106 + request pages from the page allocator. The memory allocated by `vmalloc` 107 + and related functions is not physically contiguous. 109 108 110 109 If you are not sure whether the allocation size is too large for 111 - `kmalloc`, it is possible to use :c:func:`kvmalloc` and its 112 - derivatives. It will try to allocate memory with `kmalloc` and if the 113 - allocation fails it will be retried with `vmalloc`. There are 114 - restrictions on which GFP flags can be used with `kvmalloc`; please 115 - see :c:func:`kvmalloc_node` reference documentation. Note that 116 - `kvmalloc` may return memory that is not physically contiguous. 110 + `kmalloc`, it is possible to use kvmalloc() and its derivatives. It will 111 + try to allocate memory with `kmalloc` and if the allocation fails it 112 + will be retried with `vmalloc`. There are restrictions on which GFP 113 + flags can be used with `kvmalloc`; please see kvmalloc_node() reference 114 + documentation. Note that `kvmalloc` may return memory that is not 115 + physically contiguous. 117 116 118 117 If you need to allocate many identical objects you can use the slab 119 - cache allocator. The cache should be set up with 120 - :c:func:`kmem_cache_create` or :c:func:`kmem_cache_create_usercopy` 121 - before it can be used. The second function should be used if a part of 122 - the cache might be copied to the userspace. After the cache is 123 - created :c:func:`kmem_cache_alloc` and its convenience wrappers can 124 - allocate memory from that cache. 118 + cache allocator. The cache should be set up with kmem_cache_create() or 119 + kmem_cache_create_usercopy() before it can be used. The second function 120 + should be used if a part of the cache might be copied to the userspace. 121 + After the cache is created kmem_cache_alloc() and its convenience 122 + wrappers can allocate memory from that cache. 125 123 126 - When the allocated memory is no longer needed it must be freed. You 127 - can use :c:func:`kvfree` for the memory allocated with `kmalloc`, 128 - `vmalloc` and `kvmalloc`. The slab caches should be freed with 129 - :c:func:`kmem_cache_free`. And don't forget to destroy the cache with 130 - :c:func:`kmem_cache_destroy`. 124 + When the allocated memory is no longer needed it must be freed. You can 125 + use kvfree() for the memory allocated with `kmalloc`, `vmalloc` and 126 + `kvmalloc`. The slab caches should be freed with kmem_cache_free(). And 127 + don't forget to destroy the cache with kmem_cache_destroy().