linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] slab: add kmalloc() to kernel API documentation
@ 2013-06-25 16:16 Michael Opdenacker
  2013-06-25 17:37 ` Randy Dunlap
  2013-07-01 18:41 ` Christoph Lameter
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Opdenacker @ 2013-06-25 16:16 UTC (permalink / raw)
  To: cl, penberg, mpm, linux-mm, linux-kernel; +Cc: Michael Opdenacker

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.

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
---
 include/linux/slab.h     | 18 ++++++++++++++----
 include/linux/slob_def.h |  8 --------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/include/linux/slab.h b/include/linux/slab.h
index 0c62175..dffc7a2 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -356,9 +356,8 @@ int cache_show(struct kmem_cache *s, struct seq_file *m);
 void print_slabinfo_header(struct seq_file *m);
 
 /**
- * kmalloc_array - allocate memory for an array.
- * @n: number of elements.
- * @size: element size.
+ * kmalloc - allocate memory
+ * @size: how many bytes of memory are required.
  * @flags: the type of memory to allocate.
  *
  * The @flags argument may be one of:
@@ -405,6 +404,17 @@ void print_slabinfo_header(struct seq_file *m);
  * 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
  * 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)
 {
@@ -428,7 +438,7 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
 /**
  * kmalloc_node - allocate memory from a specific node
  * @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.
  *
  * kmalloc() for non-local nodes, used to allocate from a specific node
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
index f28e14a..095a5a4 100644
--- a/include/linux/slob_def.h
+++ b/include/linux/slob_def.h
@@ -18,14 +18,6 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int 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)
 {
 	return __kmalloc_node(size, flags, NUMA_NO_NODE);
-- 
1.8.1.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] slab: add kmalloc() to kernel API documentation
  2013-06-25 16:16 [PATCH] slab: add kmalloc() to kernel API documentation Michael Opdenacker
@ 2013-06-25 17:37 ` Randy Dunlap
  2013-07-01 18:41 ` Christoph Lameter
  1 sibling, 0 replies; 4+ messages in thread
From: Randy Dunlap @ 2013-06-25 17:37 UTC (permalink / raw)
  To: Michael Opdenacker; +Cc: cl, penberg, mpm, linux-mm, linux-kernel

On 06/25/13 09:16, Michael Opdenacker wrote:
> 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.
> 
> Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>\

Acked-by: Randy Dunlap <rdunlap@infradead.org>

Thanks.


> ---
>  include/linux/slab.h     | 18 ++++++++++++++----
>  include/linux/slob_def.h |  8 --------
>  2 files changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index 0c62175..dffc7a2 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -356,9 +356,8 @@ int cache_show(struct kmem_cache *s, struct seq_file *m);
>  void print_slabinfo_header(struct seq_file *m);
>  
>  /**
> - * kmalloc_array - allocate memory for an array.
> - * @n: number of elements.
> - * @size: element size.
> + * kmalloc - allocate memory
> + * @size: how many bytes of memory are required.
>   * @flags: the type of memory to allocate.
>   *
>   * The @flags argument may be one of:
> @@ -405,6 +404,17 @@ void print_slabinfo_header(struct seq_file *m);
>   * 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
>   * 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)
>  {
> @@ -428,7 +438,7 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
>  /**
>   * kmalloc_node - allocate memory from a specific node
>   * @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.
>   *
>   * kmalloc() for non-local nodes, used to allocate from a specific node
> diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
> index f28e14a..095a5a4 100644
> --- a/include/linux/slob_def.h
> +++ b/include/linux/slob_def.h
> @@ -18,14 +18,6 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int 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)
>  {
>  	return __kmalloc_node(size, flags, NUMA_NO_NODE);
> 


-- 
~Randy

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] slab: add kmalloc() to kernel API documentation
  2013-06-25 16:16 [PATCH] slab: add kmalloc() to kernel API documentation Michael Opdenacker
  2013-06-25 17:37 ` Randy Dunlap
@ 2013-07-01 18:41 ` Christoph Lameter
  2013-07-07 16:03   ` Pekka Enberg
  1 sibling, 1 reply; 4+ messages in thread
From: Christoph Lameter @ 2013-07-01 18:41 UTC (permalink / raw)
  To: Michael Opdenacker; +Cc: penberg, mpm, linux-mm, linux-kernel

On Tue, 25 Jun 2013, Michael Opdenacker wrote:

> 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>

Note that this will conflict with one of my pending patches that also
addresses one of these issues but this work is much more comprehensive.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] slab: add kmalloc() to kernel API documentation
  2013-07-01 18:41 ` Christoph Lameter
@ 2013-07-07 16:03   ` Pekka Enberg
  0 siblings, 0 replies; 4+ messages in thread
From: Pekka Enberg @ 2013-07-07 16:03 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: Michael Opdenacker, Matt Mackall, linux-mm@kvack.org, LKML

On Mon, Jul 1, 2013 at 9:41 PM, Christoph Lameter <cl@linux.com> wrote:
> On Tue, 25 Jun 2013, Michael Opdenacker wrote:
>
>> 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>

Applied, thanks!

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-07-07 16:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-25 16:16 [PATCH] slab: add kmalloc() to kernel API documentation Michael Opdenacker
2013-06-25 17:37 ` Randy Dunlap
2013-07-01 18:41 ` Christoph Lameter
2013-07-07 16:03   ` Pekka Enberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).