* [PATCH] docs/core-api: memory-allocation: clarify when to use kzalloc_obj and kzalloc
@ 2026-09-07 6:36 Mike Rapoport
2026-09-07 7:12 ` Vlastimil Babka (SUSE)
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Mike Rapoport @ 2026-09-07 6:36 UTC (permalink / raw)
To: Andrew Morton, David Hildenbrand, Jonathan Corbet
Cc: Liam R. Howlett, Lorenzo Stoakes, Michal Hocko, Mike Rapoport,
Randy Dunlap, SJ Park, Shuah Khan, Suren Baghdasaryan,
Vlastimil Babka, linux-doc, linux-kernel, linux-mm
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>
---
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
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] docs/core-api: memory-allocation: clarify when to use kzalloc_obj and kzalloc
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)
2026-09-07 10:40 ` David Hildenbrand (Arm)
2 siblings, 0 replies; 4+ messages in thread
From: Vlastimil Babka (SUSE) @ 2026-09-07 7:12 UTC (permalink / raw)
To: Mike Rapoport, Andrew Morton, David Hildenbrand, Jonathan Corbet
Cc: Liam R. Howlett, Lorenzo Stoakes, Michal Hocko, Randy Dunlap,
SJ Park, Shuah Khan, Suren Baghdasaryan, linux-doc, linux-kernel,
linux-mm
On 9/7/26 08:36, 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>
Acked-by: Vlastimil Babka (SUSE) <vbabka@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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] docs/core-api: memory-allocation: clarify when to use kzalloc_obj and kzalloc
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)
2026-09-07 10:40 ` David Hildenbrand (Arm)
2 siblings, 0 replies; 4+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-09-07 7:27 UTC (permalink / raw)
To: Mike Rapoport
Cc: Andrew Morton, David Hildenbrand, Jonathan Corbet,
Liam R. Howlett, Michal Hocko, Randy Dunlap, SJ Park, Shuah Khan,
Suren Baghdasaryan, Vlastimil Babka, linux-doc, linux-kernel,
linux-mm
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] docs/core-api: memory-allocation: clarify when to use kzalloc_obj and kzalloc
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)
@ 2026-09-07 10:40 ` David Hildenbrand (Arm)
2 siblings, 0 replies; 4+ messages in thread
From: David Hildenbrand (Arm) @ 2026-09-07 10:40 UTC (permalink / raw)
To: Mike Rapoport, Andrew Morton, Jonathan Corbet
Cc: Liam R. Howlett, Lorenzo Stoakes, Michal Hocko, Randy Dunlap,
SJ Park, Shuah Khan, Suren Baghdasaryan, Vlastimil Babka,
linux-doc, linux-kernel, linux-mm
On 9/7/26 08:36, 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>
> ---
Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-07 10:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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)
2026-09-07 10:40 ` David Hildenbrand (Arm)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®