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

From: Heiko Carstens

Date: Mon Sep 14 2026 - 14:41:21 EST


On Thu, Sep 10, 2026 at 02:00:08PM +0300, Mike Rapoport (Microsoft) wrote:
> alloc_cmb() allocates the channel measurement block area shared by
> devices using the basic channel measurement format.
...
> The measurement block origin must be 32-byte aligned. Each CMB is
> 32 bytes, so kmalloc() provides the required alignment without rounding
> the allocation to a power-of-two number of pages. Reject an empty area
> before allocating it.
>
> Replace use of __get_free_pages() with kmalloc() and free_pages() with
> kfree().
...
> spin_unlock(&cmb_area.lock);
> - 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).
But... I doubt it is worth it to send yet another version just for this.

The whole series looks good to me. Vineeth, Peter, any thoughts?