sclp_init() allocates the SCCBs used for reading SCLP events and for the SCLP init mask request. These buffers can be allocated with kmalloc() as there's nothing special about them 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_free_page() with kmalloc() and free_page() with kfree(). Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com Reviewed-by: Heiko Carstens Signed-off-by: Mike Rapoport (Microsoft) --- drivers/s390/char/sclp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/s390/char/sclp.c b/drivers/s390/char/sclp.c index 98e334724a62..bfbac6dfa053 100644 --- a/drivers/s390/char/sclp.c +++ b/drivers/s390/char/sclp.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -1268,8 +1269,8 @@ int sclp_init(void) if (sclp_init_state != sclp_init_state_uninitialized) goto fail_unlock; sclp_init_state = sclp_init_state_initializing; - sclp_read_sccb = (void *) __get_free_page(GFP_ATOMIC | GFP_DMA); - sclp_init_sccb = (void *) __get_free_page(GFP_ATOMIC | GFP_DMA); + sclp_read_sccb = kmalloc(PAGE_SIZE, GFP_ATOMIC | GFP_DMA); + sclp_init_sccb = kmalloc(PAGE_SIZE, GFP_ATOMIC | GFP_DMA); BUG_ON(!sclp_read_sccb || !sclp_init_sccb); /* Set up variables */ list_add(&sclp_state_change_event.list, &sclp_reg_list); @@ -1302,8 +1303,8 @@ int sclp_init(void) fail_init_state_uninitialized: list_del(&sclp_state_change_event.list); sclp_init_state = sclp_init_state_uninitialized; - free_page((unsigned long) sclp_read_sccb); - free_page((unsigned long) sclp_init_sccb); + kfree(sclp_read_sccb); + kfree(sclp_init_sccb); fail_unlock: spin_unlock_irqrestore(&sclp_lock, flags); return rc; -- 2.53.0