Re: [PATCH] xfs: replace kvmalloc_array with kvzalloc_objs
From: Carlos Maiolino
Date: Fri Sep 18 2026 - 07:32:48 EST
On Fri, Sep 18, 2026 at 04:16:46AM -0700, Christoph Hellwig wrote:
> On Fri, Sep 18, 2026 at 07:16:32AM +0200, Carlos Maiolino wrote:
> > On Thu, Sep 17, 2026 at 08:08:35PM +0000, Lalit Shankar Chowdhury wrote:
> > > Replace kvmalloc_array() with the more concise kvzalloc_objs()
> > > implementation.
> > >
> > > Signed-off-by: Lalit Shankar Chowdhury <lalitshankarch@xxxxxxxxx>
> >
> > NAK...
> >
> > This is used to allocate composite objects managed through a
> > slab cache. This is not for fundamental basic data types....
>
> I don't think so. While the naming of the helper is a bit
> unfortunate, it is intended for allocating arrays.
I see your point, but what kv(z)alloc_objs() do is essentially
kmalloc(sizeof(object type) * count, GFP)...
While I see why it's useful for composite types, I don't see the much
the point of doing kvzalloc_objs(int, count)..
And still kvmalloc_array() looks a better fit in this case IMO than
kvmalloc_objs().
>
> But this function really should not exist, instead bitmap_alloc/free
> should be switched to th kvmalloc family so that it will just work
> for large allocations and we can kill the wrappers in XFS.
>
+1