Commit e7efa615 authored by Michael Opdenacker's avatar Michael Opdenacker Committed by Pekka Enberg

slab: add kmalloc() to kernel API documentation

At the moment, kmalloc() isn't even listed in the kernel API
documentation (DocBook/kernel-api.html after running "make htmldocs").

Another issue is that the documentation for kmalloc_node()
refers to kcalloc()'s documentation to describe its 'flags' parameter,
while kcalloc() refered to kmalloc()'s documentation, which doesn't exist!

This patch is a proposed fix for this. It also removes the documentation
for kmalloc() in include/linux/slob_def.h which isn't included to
generate the documentation anyway. This way, kmalloc() is described
in only one place.
Acked-by: default avatarChristoph Lameter <cl@linux.com>
Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Signed-off-by: default avatarMichael Opdenacker <michael.opdenacker@free-electrons.com>
Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
parent 0f8f8094
...@@ -373,9 +373,8 @@ int cache_show(struct kmem_cache *s, struct seq_file *m); ...@@ -373,9 +373,8 @@ int cache_show(struct kmem_cache *s, struct seq_file *m);
void print_slabinfo_header(struct seq_file *m); void print_slabinfo_header(struct seq_file *m);
/** /**
* kmalloc_array - allocate memory for an array. * kmalloc - allocate memory
* @n: number of elements. * @size: how many bytes of memory are required.
* @size: element size.
* @flags: the type of memory to allocate. * @flags: the type of memory to allocate.
* *
* The @flags argument may be one of: * The @flags argument may be one of:
...@@ -422,6 +421,17 @@ void print_slabinfo_header(struct seq_file *m); ...@@ -422,6 +421,17 @@ void print_slabinfo_header(struct seq_file *m);
* There are other flags available as well, but these are not intended * There are other flags available as well, but these are not intended
* for general use, and so are not documented here. For a full list of * for general use, and so are not documented here. For a full list of
* potential flags, always refer to linux/gfp.h. * potential flags, always refer to linux/gfp.h.
*
* kmalloc is the normal method of allocating memory
* in the kernel.
*/
static __always_inline void *kmalloc(size_t size, gfp_t flags);
/**
* kmalloc_array - allocate memory for an array.
* @n: number of elements.
* @size: element size.
* @flags: the type of memory to allocate (see kmalloc).
*/ */
static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags) static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
{ {
...@@ -445,7 +455,7 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags) ...@@ -445,7 +455,7 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
/** /**
* kmalloc_node - allocate memory from a specific node * kmalloc_node - allocate memory from a specific node
* @size: how many bytes of memory are required. * @size: how many bytes of memory are required.
* @flags: the type of memory to allocate (see kcalloc). * @flags: the type of memory to allocate (see kmalloc).
* @node: node to allocate from. * @node: node to allocate from.
* *
* kmalloc() for non-local nodes, used to allocate from a specific node * kmalloc() for non-local nodes, used to allocate from a specific node
......
...@@ -18,14 +18,6 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) ...@@ -18,14 +18,6 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
return __kmalloc_node(size, flags, node); return __kmalloc_node(size, flags, node);
} }
/**
* kmalloc - allocate memory
* @size: how many bytes of memory are required.
* @flags: the type of memory to allocate (see kcalloc).
*
* kmalloc is the normal method of allocating memory
* in the kernel.
*/
static __always_inline void *kmalloc(size_t size, gfp_t flags) static __always_inline void *kmalloc(size_t size, gfp_t flags)
{ {
return __kmalloc_node(size, flags, NUMA_NO_NODE); return __kmalloc_node(size, flags, NUMA_NO_NODE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment