From: Jonathan Corbet <corbet@lwn.net>
To: Manuel Ebner <manuelebner@mailbox.org>,
Shuah Khan <skhan@linuxfoundation.org>,
linux-doc@vger.kernel.org
Cc: lrcu@vger.kernel.org, linux-kernel@vger.kernel.org,
workflows@vger.kernel.org, linux-sound@vger.kernel.org,
rcu@vger.kernel.org, linux-media@vger.kernel.org,
Manuel Ebner <manuelebner@mailbox.org>,
Kees Cook <kees@kernel.org>
Subject: Re: [PATCH] Documentation: adopt new coding style of type-aware kmalloc-family
Date: Sun, 19 Apr 2026 04:29:48 -0600 [thread overview]
Message-ID: <87se8rw8df.fsf@trenco.lwn.net> (raw)
In-Reply-To: <20260419065824.165921-4-manuelebner@mailbox.org>
Manuel Ebner <manuelebner@mailbox.org> writes:
> Update the documentation to reflect new type-aware kmalloc-family as
> suggested in commit 2932ba8d9c99 ("slab: Introduce kmalloc_obj() and family")
>
> ptr = kmalloc(sizeof(*ptr), gfp);
> -> ptr = kmalloc_obj(*ptr, gfp);
> ptr = kmalloc(sizeof(struct some_obj_name), gfp);
> -> ptr = kmalloc_obj(*ptr, gfp);
> ptr = kzalloc(sizeof(*ptr), gfp);
> -> ptr = kzalloc_obj(*ptr, gfp);
> ptr = kmalloc_array(count, sizeof(*ptr), gfp);
> -> ptr = kmalloc_objs(*ptr, count, gfp);
> ptr = kcalloc(count, sizeof(*ptr), gfp);
> -> ptr = kzalloc_objs(*ptr, count, gfp);
>
> Signed-off-by: Manuel Ebner <manuelebner@mailbox.org>
Just to be sure, did you write this patch yourself, or did you use some
sort of coding assistant?
Adding Kees, who did this work and might have something to add here.
> ---
> .../RCU/Design/Requirements/Requirements.rst | 6 +++---
> Documentation/RCU/listRCU.rst | 2 +-
> Documentation/RCU/whatisRCU.rst | 4 ++--
This patch will surely need to be split up; the RCU folks, for example,
will want to evaluate the change separately.
> Documentation/core-api/kref.rst | 4 ++--
> Documentation/core-api/list.rst | 4 ++--
> Documentation/core-api/memory-allocation.rst | 4 ++--
> Documentation/driver-api/mailbox.rst | 4 ++--
> Documentation/driver-api/media/v4l2-fh.rst | 2 +-
> Documentation/kernel-hacking/locking.rst | 4 ++--
> Documentation/locking/locktypes.rst | 4 ++--
> Documentation/process/coding-style.rst | 8 ++++----
> .../sound/kernel-api/writing-an-alsa-driver.rst | 12 ++++++------
> Documentation/spi/spi-summary.rst | 4 ++--
> .../translations/it_IT/kernel-hacking/locking.rst | 4 ++--
> .../translations/it_IT/locking/locktypes.rst | 4 ++--
> .../translations/it_IT/process/coding-style.rst | 2 +-
> .../translations/sp_SP/process/coding-style.rst | 2 +-
> Documentation/translations/zh_CN/core-api/kref.rst | 4 ++--
> .../translations/zh_CN/process/coding-style.rst | 2 +-
> .../zh_CN/video4linux/v4l2-framework.txt | 2 +-
> .../translations/zh_TW/process/coding-style.rst | 2 +-
> 21 files changed, 42 insertions(+), 42 deletions(-)
>
> diff --git a/Documentation/RCU/Design/Requirements/Requirements.rst b/Documentation/RCU/Design/Requirements/Requirements.rst
> index b5cdbba3ec2e..faca5a9c8c12 100644
> --- a/Documentation/RCU/Design/Requirements/Requirements.rst
> +++ b/Documentation/RCU/Design/Requirements/Requirements.rst
> @@ -206,7 +206,7 @@ non-\ ``NULL``, locklessly accessing the ``->a`` and ``->b`` fields.
>
> 1 bool add_gp_buggy(int a, int b)
> 2 {
> - 3 p = kmalloc(sizeof(*p), GFP_KERNEL);
> + 3 p = kmalloc_obj(*p, GFP_KERNEL);
So you have not gone with the "implicit GFP_KERNEL" approach that Linus
added. Given that, I assume, he wanted that to be the normal style, we
should probably go with it.
Thanks,
jon
next prev parent reply other threads:[~2026-04-19 10:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-19 6:58 [PATCH] Documentation: adopt new coding style of type-aware kmalloc-family Manuel Ebner
2026-04-19 10:29 ` Jonathan Corbet [this message]
2026-04-19 11:33 ` Manuel Ebner
2026-04-19 11:43 ` Jonathan Corbet
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=87se8rw8df.fsf@trenco.lwn.net \
--to=corbet@lwn.net \
--cc=kees@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=lrcu@vger.kernel.org \
--cc=manuelebner@mailbox.org \
--cc=rcu@vger.kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=workflows@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox