linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] coding-style.rst: Generic alloc functions do not need OOM logging
@ 2019-03-30 17:25 Joe Perches
  2019-04-01 21:01 ` Jonathan Corbet
  2019-04-01 21:12 ` Nick Crews
  0 siblings, 2 replies; 3+ messages in thread
From: Joe Perches @ 2019-03-30 17:25 UTC (permalink / raw)
  To: Jonathan Corbet; +Cc: Nick Crews, LKML, linux-doc

Generic allocation functions already emit a dump_stack()
so additional error logging isn't useful.

Document it as such and add a reference to the allocation
API.

Signed-off-by: Joe Perches <joe@perches.com>
---
 Documentation/process/coding-style.rst | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
index 8ea913e99fa1..fa864a51e6ea 100644
--- a/Documentation/process/coding-style.rst
+++ b/Documentation/process/coding-style.rst
@@ -843,7 +843,8 @@ used.
 The kernel provides the following general purpose memory allocators:
 kmalloc(), kzalloc(), kmalloc_array(), kcalloc(), vmalloc(), and
 vzalloc().  Please refer to the API documentation for further information
-about them.
+about them.  :ref:`Documentation/core-api/memory-allocation.rst
+<memory_allocation>`
 
 The preferred form for passing a size of a struct is the following:
 
@@ -874,6 +875,9 @@ The preferred form for allocating a zeroed array is the following:
 Both forms check for overflow on the allocation size n * sizeof(...),
 and return NULL if that occurred.
 
+These generic allocation functions all emit a stack dump on failure when used
+without __GFP_NOWARN so there is no use in emitting an additional failure
+message when NULL is returned.
 
 15) The inline disease
 ----------------------


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

* Re: [PATCH] coding-style.rst: Generic alloc functions do not need OOM logging
  2019-03-30 17:25 [PATCH] coding-style.rst: Generic alloc functions do not need OOM logging Joe Perches
@ 2019-04-01 21:01 ` Jonathan Corbet
  2019-04-01 21:12 ` Nick Crews
  1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Corbet @ 2019-04-01 21:01 UTC (permalink / raw)
  To: Joe Perches; +Cc: Nick Crews, LKML, linux-doc

On Sat, 30 Mar 2019 10:25:03 -0700
Joe Perches <joe@perches.com> wrote:

> Generic allocation functions already emit a dump_stack()
> so additional error logging isn't useful.
> 
> Document it as such and add a reference to the allocation
> API.
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Applied, thanks.

jon

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

* Re: [PATCH] coding-style.rst: Generic alloc functions do not need OOM logging
  2019-03-30 17:25 [PATCH] coding-style.rst: Generic alloc functions do not need OOM logging Joe Perches
  2019-04-01 21:01 ` Jonathan Corbet
@ 2019-04-01 21:12 ` Nick Crews
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Crews @ 2019-04-01 21:12 UTC (permalink / raw)
  To: Joe Perches; +Cc: Jonathan Corbet, LKML, linux-doc

Thanks Joe, this is a great detail to add.

On Sat, Mar 30, 2019 at 11:25 AM Joe Perches <joe@perches.com> wrote:
>
> Generic allocation functions already emit a dump_stack()
> so additional error logging isn't useful.
>
> Document it as such and add a reference to the allocation
> API.
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  Documentation/process/coding-style.rst | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
> index 8ea913e99fa1..fa864a51e6ea 100644
> --- a/Documentation/process/coding-style.rst
> +++ b/Documentation/process/coding-style.rst
> @@ -843,7 +843,8 @@ used.
>  The kernel provides the following general purpose memory allocators:
>  kmalloc(), kzalloc(), kmalloc_array(), kcalloc(), vmalloc(), and
>  vzalloc().  Please refer to the API documentation for further information
> -about them.
> +about them.  :ref:`Documentation/core-api/memory-allocation.rst
> +<memory_allocation>`
>
>  The preferred form for passing a size of a struct is the following:
>
> @@ -874,6 +875,9 @@ The preferred form for allocating a zeroed array is the following:
>  Both forms check for overflow on the allocation size n * sizeof(...),
>  and return NULL if that occurred.
>
> +These generic allocation functions all emit a stack dump on failure when used
> +without __GFP_NOWARN so there is no use in emitting an additional failure
> +message when NULL is returned.
>
>  15) The inline disease
>  ----------------------
>

Acked-by: Nick Crews <ncrews@chromium.org>

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

end of thread, other threads:[~2019-04-01 21:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-30 17:25 [PATCH] coding-style.rst: Generic alloc functions do not need OOM logging Joe Perches
2019-04-01 21:01 ` Jonathan Corbet
2019-04-01 21:12 ` Nick Crews

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