Re: [PATCH v2 06/13] s390/cmf: Use kmalloc() for the CMB area

From: Heiko Carstens

Date: Wed Sep 16 2026 - 05:29:09 EST


On Tue, Sep 15, 2026 at 09:37:51PM +0300, Mike Rapoport wrote:
> On Mon, Sep 14, 2026 at 07:59:52PM +0200, Heiko Carstens wrote:
> > On Thu, Sep 10, 2026 at 02:00:08PM +0300, Mike Rapoport (Microsoft) wrote:
> > > - mem = (void *)__get_free_pages(GFP_KERNEL, get_order(size));
> > > + mem = kmalloc(size, GFP_KERNEL);
> > > spin_lock(&cmb_area.lock);
> > >
> > > if (cmb_area.mem) {
> > > /* ok, another thread was faster */
> > > - free_pages((unsigned long)mem, get_order(size));
> > > + kfree(mem);
> > > } else if (!mem) {
> > > /* no luck */
> > > ret = -ENOMEM;
> >
> > This is the only patch which made me raise an eyebrow, since the allocated
> > area is smaller. But it looks all good according to the architecture.
> > Since the allocation changed anyway, it might also make sense to switch to
> > kzalloc() and get rid of the subsequent memset() (not in the context of the
> > above diff).
>
> I suppose separate alloc and memset() are there to save a couple of cycles
> when another thread is the first to allocate, no idea how important this is
> though :)

I don't think this is important. Anyway let's keep this as simple as
possible and just do the conversion without any further changes.