Skip to content

Commit e7efa61

Browse files
Michael Opdenackerpenberg
authored andcommitted
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: Christoph Lameter <cl@linux.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
1 parent 0f8f809 commit e7efa61

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

include/linux/slab.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,9 +373,8 @@ int cache_show(struct kmem_cache *s, struct seq_file *m);
373373
void print_slabinfo_header(struct seq_file *m);
374374

375375
/**
376-
* kmalloc_array - allocate memory for an array.
377-
* @n: number of elements.
378-
* @size: element size.
376+
* kmalloc - allocate memory
377+
* @size: how many bytes of memory are required.
379378
* @flags: the type of memory to allocate.
380379
*
381380
* The @flags argument may be one of:
@@ -422,6 +421,17 @@ void print_slabinfo_header(struct seq_file *m);
422421
* There are other flags available as well, but these are not intended
423422
* for general use, and so are not documented here. For a full list of
424423
* potential flags, always refer to linux/gfp.h.
424+
*
425+
* kmalloc is the normal method of allocating memory
426+
* in the kernel.
427+
*/
428+
static __always_inline void *kmalloc(size_t size, gfp_t flags);
429+
430+
/**
431+
* kmalloc_array - allocate memory for an array.
432+
* @n: number of elements.
433+
* @size: element size.
434+
* @flags: the type of memory to allocate (see kmalloc).
425435
*/
426436
static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
427437
{
@@ -445,7 +455,7 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
445455
/**
446456
* kmalloc_node - allocate memory from a specific node
447457
* @size: how many bytes of memory are required.
448-
* @flags: the type of memory to allocate (see kcalloc).
458+
* @flags: the type of memory to allocate (see kmalloc).
449459
* @node: node to allocate from.
450460
*
451461
* kmalloc() for non-local nodes, used to allocate from a specific node

include/linux/slob_def.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
1818
return __kmalloc_node(size, flags, node);
1919
}
2020

21-
/**
22-
* kmalloc - allocate memory
23-
* @size: how many bytes of memory are required.
24-
* @flags: the type of memory to allocate (see kcalloc).
25-
*
26-
* kmalloc is the normal method of allocating memory
27-
* in the kernel.
28-
*/
2921
static __always_inline void *kmalloc(size_t size, gfp_t flags)
3022
{
3123
return __kmalloc_node(size, flags, NUMA_NO_NODE);

0 commit comments

Comments
 (0)