From: "Miquel Sabaté Solà" <mssola@mssola.com>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
"dsterba@suse.com" <dsterba@suse.com>,
"clm@fb.com" <clm@fb.com>, Naohiro Aota <Naohiro.Aota@wdc.com>,
"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kees@kernel.org" <kees@kernel.org>
Subject: Re: [PATCH] btrfs: replace kcalloc() calls to kzalloc_objs()
Date: Tue, 24 Feb 2026 10:04:22 +0100 [thread overview]
Message-ID: <87ldgi5x7t.fsf@> (raw)
In-Reply-To: <c1394e2e-fa7b-496f-9fb2-3e88e9d42044@gmx.com> (Qu Wenruo's message of "Tue, 24 Feb 2026 17:24:04 +1030")
[-- Attachment #1: Type: text/plain, Size: 1914 bytes --]
Qu Wenruo @ 2026-02-24 17:24 +1030:
> 在 2026/2/24 17:16, Miquel Sabaté Solà 写道:
>> Johannes Thumshirn @ 2026-02-24 06:32 GMT:
>>
>>> On 2/24/26 12:45 AM, Miquel Sabaté Solà wrote:
>>>> Commit 2932ba8d9c99 ("slab: Introduce kmalloc_obj() and family")
>>>> introduced, among many others, the kzalloc_objs() helper, which has some
>>>> benefits over kcalloc().
>>> Namely?
>> I didn't want to repeat the arguments from the quoted commit
>> 2932ba8d9c99 ("slab: Introduce kmalloc_obj() and family"). Namely:
>
> If you assume every btrfs developer is aware of all slab/mm/vfs/whatever
> subsystem development, then I'd say you're wrong.
To be fair, what I quoted comes from the git log for that commit. So I
was not assuming a subscription to any list or following of other
subsystems. If that's how I sounded, then I apologise.
>
> Thus you should mention the commit (which is not yet in our developmenet tree),
> and at least have a short reason on the benefit.
Regardless of the above, both you and Johannes bring a fair point. I
will expand the git message just so people don't have to lookup in other
places to get the full context of the change. I'll do that on v2.
Thanks!
Miquel
>
>>
>>> Internal introspection of the allocated type now becomes possible,
>>> allowing for future alignment-aware choices to be made by the
>>> allocator and future hardening work that can be type sensitive.
>> Should I put this in the commit message as well, regardless of the
>> commit explaining this being quoted?
>> There's also the argument of dropping 'sizeof' to be more ergonomic. To
>> me, though, and considering how these helpers have been applied
>> tree-wide, I see this change more as aligning us with this recent
>> tree-wide move, which also affected btrfs (see commit 69050f8d6d07
>> "treewide: Replace kmalloc with kmalloc_obj for non-scalar types").
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 897 bytes --]
prev parent reply other threads:[~2026-02-24 9:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 23:44 [PATCH] btrfs: replace kcalloc() calls to kzalloc_objs() Miquel Sabaté Solà
2026-02-24 0:06 ` Kees Cook
2026-02-24 6:23 ` Miquel Sabaté Solà
[not found] ` <699d43e6.170a0220.3a6e96.a235SMTPIN_ADDED_BROKEN@mx.google.com>
2026-02-24 11:29 ` David Sterba
2026-02-24 12:23 ` Miquel Sabaté Solà
2026-02-24 4:37 ` Qu Wenruo
2026-02-24 4:42 ` Qu Wenruo
2026-02-24 13:52 ` David Sterba
2026-02-24 6:36 ` Miquel Sabaté Solà
[not found] ` <699d4704.050a0220.1a6450.86d7SMTPIN_ADDED_BROKEN@mx.google.com>
2026-02-24 6:48 ` Qu Wenruo
2026-02-24 8:59 ` Miquel Sabaté Solà
2026-02-24 14:55 ` David Laight
2026-02-25 14:44 ` David Sterba
2026-02-25 17:11 ` David Laight
2026-02-24 6:32 ` Johannes Thumshirn
2026-02-24 6:46 ` Miquel Sabaté Solà
2026-02-24 6:54 ` Qu Wenruo
2026-02-24 9:04 ` Miquel Sabaté Solà [this message]
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=87ldgi5x7t.fsf@ \
--to=mssola@mssola.com \
--cc=Johannes.Thumshirn@wdc.com \
--cc=Naohiro.Aota@wdc.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=kees@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quwenruo.btrfs@gmx.com \
/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