From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: Mike Rapoport <rppt@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
"Liam R. Howlett" <liam@infradead.org>,
Michal Hocko <mhocko@suse.com>,
Randy Dunlap <rdunlap@infradead.org>, SJ Park <sj@kernel.org>,
Shuah Khan <skhan@linuxfoundation.org>,
Suren Baghdasaryan <surenb@google.com>,
Vlastimil Babka <vbabka@kernel.org>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH] docs/core-api: memory-allocation: clarify when to use kzalloc_obj and kzalloc
Date: Mon, 7 Sep 2026 08:27:15 +0100 [thread overview]
Message-ID: <ap5nTcKoDyiybuxH@gremlin> (raw)
In-Reply-To: <20260907063654.2248617-1-rppt@kernel.org>
On Mon, Sep 07, 2026 at 09:36:54AM +0300, Mike Rapoport wrote:
> From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
>
> Make it abundantly clear that in the most cases objects should be
> allocated with kzalloc_obj() and buffers should be allocated with
> kzalloc().
>
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
LGTM so
Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> ---
>
> This applies on top of "docs/core-api: memory-allocation: add
> k[mz]alloc_obj() and clarify kmalloc" series
>
> https://lore.kernel.org/all/20260902-docs-memalloc-guide-v2-0-218c1a4dcb80@kernel.org
>
> Documentation/core-api/memory-allocation.rst | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/core-api/memory-allocation.rst b/Documentation/core-api/memory-allocation.rst
> index 823f7fa57429b..648222b6c8576 100644
> --- a/Documentation/core-api/memory-allocation.rst
> +++ b/Documentation/core-api/memory-allocation.rst
> @@ -23,12 +23,14 @@ answer, although very likely you should use
>
> kzalloc_obj(<VAR_OR_TYPE>);
>
> -or
> +if you need memory for an object and
>
> ::
>
> kzalloc(<size>, GFP_KERNEL);
>
> +if you need memory for a buffer.
> +
> Of course there are cases when other allocation APIs and different GFP
> flags must be used.
>
>
> base-commit: d7dd88ed029164fe0a959e126d0ce18dd3719f89
> --
> 2.53.0
>
--
Cheers, Lorenzo
next prev parent reply other threads:[~2026-09-07 7:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-07 6:36 [PATCH] docs/core-api: memory-allocation: clarify when to use kzalloc_obj and kzalloc Mike Rapoport
2026-09-07 7:12 ` Vlastimil Babka (SUSE)
2026-09-07 7:27 ` Lorenzo Stoakes (ARM) [this message]
2026-09-07 10:40 ` David Hildenbrand (Arm)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ap5nTcKoDyiybuxH@gremlin \
--to=ljs@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=david@kernel.org \
--cc=liam@infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=rdunlap@infradead.org \
--cc=rppt@kernel.org \
--cc=sj@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.