sclp_ctl_ioctl_sccb() allocates the SCCB that carries a user supplied SCLP command. This buffer can be allocated with kmalloc() as there's nothing special about it to go directly to the page allocator. kmalloc() provides a better API that does not require ugly casts and kfree() does not need to know the size of the freed object. Performance difference between kmalloc() and __get_free_pages() is not measurable as both allocators take an object/page from a per-CPU list for fast path allocations. For the slow path the performance is anyway determined by the amount of reclaim involved rather than by what allocator is used. Replace use of get_zeroed_page() with kzalloc() and free_page() with kfree(). Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com Signed-off-by: Mike Rapoport (Microsoft) --- drivers/s390/char/sclp_ctl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/s390/char/sclp_ctl.c b/drivers/s390/char/sclp_ctl.c index e23a97359286b..84aefff3be98f 100644 --- a/drivers/s390/char/sclp_ctl.c +++ b/drivers/s390/char/sclp_ctl.c @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -59,7 +60,7 @@ static int sclp_ctl_ioctl_sccb(void __user *user_area) return -EFAULT; if (!sclp_ctl_cmdw_supported(ctl_sccb.cmdw)) return -EOPNOTSUPP; - sccb = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA); + sccb = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); if (!sccb) return -ENOMEM; copied = PAGE_SIZE - @@ -79,7 +80,7 @@ static int sclp_ctl_ioctl_sccb(void __user *user_area) if (copy_to_user(u64_to_uptr(ctl_sccb.sccb), sccb, sccb->length)) rc = -EFAULT; out_free: - free_page((unsigned long) sccb); + kfree(sccb); return rc; } -- 2.53.0