* [PATCH 01/14] s390/sclp_vt220: Replace get_zeroed_page() with kzalloc()
2026-11-08 8:58 [PATCH 00/14] s390/sclp: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
@ 2026-11-08 8:58 ` Mike Rapoport (Microsoft)
2026-11-08 8:58 ` [PATCH 02/14] s390/sclp_config: " Mike Rapoport (Microsoft)
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-11-08 8:58 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
Cc: Christian Borntraeger, David Hildenbrand, Mike Rapoport,
Sven Schnelle, Vlastimil Babka, linux-s390, linux-kernel,
linux-mm
__sclp_vt220_init() allocates the SCCBs that are used as the output
buffers of the VT220 console driver.
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_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) <rppt@kernel.org>
---
drivers/s390/char/sclp_vt220.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c
index b95af0974624d..e79467c07d244 100644
--- a/drivers/s390/char/sclp_vt220.c
+++ b/drivers/s390/char/sclp_vt220.c
@@ -715,7 +715,7 @@ static void __init __sclp_vt220_free_pages(void)
list_for_each_safe(page, p, &sclp_vt220_empty) {
list_del(page);
- free_page((unsigned long) page);
+ kfree(page);
}
}
@@ -750,7 +750,7 @@ static int __init __sclp_vt220_init(int num_pages)
/* Allocate pages for output buffering */
rc = -ENOMEM;
for (i = 0; i < num_pages; i++) {
- page = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
+ page = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
if (!page)
goto out;
list_add_tail(page, &sclp_vt220_empty);
--
2.53.0
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH 02/14] s390/sclp_config: Replace get_zeroed_page() with kzalloc()
2026-11-08 8:58 [PATCH 00/14] s390/sclp: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
2026-11-08 8:58 ` [PATCH 01/14] s390/sclp_vt220: Replace get_zeroed_page() with kzalloc() Mike Rapoport (Microsoft)
@ 2026-11-08 8:58 ` Mike Rapoport (Microsoft)
2026-11-08 8:58 ` [PATCH 03/14] s390/sclp_pci: " Mike Rapoport (Microsoft)
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-11-08 8:58 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
Cc: Christian Borntraeger, David Hildenbrand, Mike Rapoport,
Sven Schnelle, Vlastimil Babka, linux-s390, linux-kernel,
linux-mm
sclp_ofb_send_req() allocates the SCCB used to send an
"Open For Business" event notification to the SCLP.
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) <rppt@kernel.org>
---
drivers/s390/char/sclp_config.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/s390/char/sclp_config.c b/drivers/s390/char/sclp_config.c
index 8c77e8c44fc23..16617a679366d 100644
--- a/drivers/s390/char/sclp_config.c
+++ b/drivers/s390/char/sclp_config.c
@@ -93,7 +93,7 @@ static int sclp_ofb_send_req(char *ev_data, size_t len)
if (len > OFB_DATA_MAX)
return -EINVAL;
- sccb = (struct sclp_ofb_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
+ sccb = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
if (!sccb)
return -ENOMEM;
/* Setup SCCB for Control-Program Identification */
@@ -119,7 +119,7 @@ static int sclp_ofb_send_req(char *ev_data, size_t len)
rc = -EIO;
}
out:
- free_page((unsigned long)sccb);
+ kfree(sccb);
return rc;
}
--
2.53.0
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH 03/14] s390/sclp_pci: Replace get_zeroed_page() with kzalloc()
2026-11-08 8:58 [PATCH 00/14] s390/sclp: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
2026-11-08 8:58 ` [PATCH 01/14] s390/sclp_vt220: Replace get_zeroed_page() with kzalloc() Mike Rapoport (Microsoft)
2026-11-08 8:58 ` [PATCH 02/14] s390/sclp_config: " Mike Rapoport (Microsoft)
@ 2026-11-08 8:58 ` Mike Rapoport (Microsoft)
2026-11-08 8:58 ` [PATCH 04/14] s390/sclp_ctl: " Mike Rapoport (Microsoft)
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-11-08 8:58 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
Cc: Christian Borntraeger, David Hildenbrand, Mike Rapoport,
Sven Schnelle, Vlastimil Babka, linux-s390, linux-kernel,
linux-mm
do_pci_configure() and sclp_pci_report() allocate the SCCBs used to
(de)configure a PCI function and to report PCI errors to the SCLP.
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_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) <rppt@kernel.org>
---
drivers/s390/char/sclp_pci.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/s390/char/sclp_pci.c b/drivers/s390/char/sclp_pci.c
index b79ef7006e46f..9e3d4b1015357 100644
--- a/drivers/s390/char/sclp_pci.c
+++ b/drivers/s390/char/sclp_pci.c
@@ -44,7 +44,7 @@ static int do_pci_configure(sclp_cmdw_t cmd, u32 fid)
if (!SCLP_HAS_PCI_RECONFIG)
return -EOPNOTSUPP;
- sccb = (struct pci_cfg_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
+ sccb = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
if (!sccb)
return -ENOMEM;
@@ -65,7 +65,7 @@ static int do_pci_configure(sclp_cmdw_t cmd, u32 fid)
break;
}
out:
- free_page((unsigned long) sccb);
+ kfree(sccb);
return rc;
}
@@ -134,7 +134,7 @@ int sclp_pci_report(struct zpci_report_error_header *report, u32 fh, u32 fid)
goto out_unregister;
}
- sccb = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
+ sccb = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
if (!sccb) {
ret = -ENOMEM;
goto out_unregister;
@@ -177,7 +177,7 @@ int sclp_pci_report(struct zpci_report_error_header *report, u32 fh, u32 fid)
}
out_free_req:
- free_page((unsigned long) sccb);
+ kfree(sccb);
out_unregister:
sclp_unregister(&sclp_pci_event);
out_unlock:
--
2.53.0
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH 04/14] s390/sclp_ctl: Replace get_zeroed_page() with kzalloc()
2026-11-08 8:58 [PATCH 00/14] s390/sclp: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
` (2 preceding siblings ...)
2026-11-08 8:58 ` [PATCH 03/14] s390/sclp_pci: " Mike Rapoport (Microsoft)
@ 2026-11-08 8:58 ` Mike Rapoport (Microsoft)
2026-11-08 8:58 ` [PATCH 05/14] s390/sclp_con: " Mike Rapoport (Microsoft)
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-11-08 8:58 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
Cc: Christian Borntraeger, David Hildenbrand, Mike Rapoport,
Sven Schnelle, Vlastimil Babka, linux-s390, linux-kernel,
linux-mm
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) <rppt@kernel.org>
---
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 <linux/uaccess.h>
+#include <linux/slab.h>
#include <linux/miscdevice.h>
#include <linux/gfp.h>
#include <linux/init.h>
@@ -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
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH 05/14] s390/sclp_con: Replace get_zeroed_page() with kzalloc()
2026-11-08 8:58 [PATCH 00/14] s390/sclp: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
` (3 preceding siblings ...)
2026-11-08 8:58 ` [PATCH 04/14] s390/sclp_ctl: " Mike Rapoport (Microsoft)
@ 2026-11-08 8:58 ` Mike Rapoport (Microsoft)
2026-11-08 8:58 ` [PATCH 06/14] s390/sclp_tty: " Mike Rapoport (Microsoft)
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-11-08 8:58 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
Cc: Christian Borntraeger, David Hildenbrand, Mike Rapoport,
Sven Schnelle, Vlastimil Babka, linux-s390, linux-kernel,
linux-mm
sclp_console_init() allocates the SCCBs that are used as the output
buffers of the SCLP line mode console.
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_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) <rppt@kernel.org>
---
drivers/s390/char/sclp_con.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/s390/char/sclp_con.c b/drivers/s390/char/sclp_con.c
index d8544c485808e..9d096d7b59687 100644
--- a/drivers/s390/char/sclp_con.c
+++ b/drivers/s390/char/sclp_con.c
@@ -8,6 +8,7 @@
*/
#include <linux/kmod.h>
+#include <linux/slab.h>
#include <linux/console.h>
#include <linux/init.h>
#include <linux/panic_notifier.h>
@@ -272,7 +273,7 @@ static void __init __sclp_console_free_pages(void)
list_for_each_safe(page, p, &sclp_con_pages) {
list_del(page);
- free_page((unsigned long)page);
+ kfree(page);
}
}
@@ -294,7 +295,7 @@ sclp_console_init(void)
return rc;
/* Allocate pages for output buffering */
for (i = 0; i < sclp_console_pages; i++) {
- page = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
+ page = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
if (!page) {
__sclp_console_free_pages();
return -ENOMEM;
--
2.53.0
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH 06/14] s390/sclp_tty: Replace get_zeroed_page() with kzalloc()
2026-11-08 8:58 [PATCH 00/14] s390/sclp: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
` (4 preceding siblings ...)
2026-11-08 8:58 ` [PATCH 05/14] s390/sclp_con: " Mike Rapoport (Microsoft)
@ 2026-11-08 8:58 ` Mike Rapoport (Microsoft)
2026-11-08 8:58 ` [PATCH 07/14] s390/sclp: Replace __get_free_page() with kmalloc() Mike Rapoport (Microsoft)
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-11-08 8:58 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
Cc: Christian Borntraeger, David Hildenbrand, Mike Rapoport,
Sven Schnelle, Vlastimil Babka, linux-s390, linux-kernel,
linux-mm
sclp_tty_init() allocates the SCCBs that are used as the output buffers
of the SCLP line mode terminal.
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_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) <rppt@kernel.org>
---
drivers/s390/char/sclp_tty.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/s390/char/sclp_tty.c b/drivers/s390/char/sclp_tty.c
index 0a92d08830e7c..e36739bd27328 100644
--- a/drivers/s390/char/sclp_tty.c
+++ b/drivers/s390/char/sclp_tty.c
@@ -9,6 +9,7 @@
*/
#include <linux/kmod.h>
+#include <linux/slab.h>
#include <linux/tty.h>
#include <linux/tty_driver.h>
#include <linux/tty_flip.h>
@@ -497,7 +498,7 @@ static void __init __sclp_tty_free_pages(void)
list_for_each_safe(page, p, &sclp_tty_pages) {
list_del(page);
- free_page((unsigned long)page);
+ kfree(page);
}
}
@@ -525,7 +526,7 @@ sclp_tty_init(void)
}
/* Allocate pages for output buffering */
for (i = 0; i < MAX_KMEM_PAGES; i++) {
- page = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
+ page = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
if (page == NULL) {
__sclp_tty_free_pages();
tty_driver_kref_put(driver);
--
2.53.0
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH 07/14] s390/sclp: Replace __get_free_page() with kmalloc()
2026-11-08 8:58 [PATCH 00/14] s390/sclp: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
` (5 preceding siblings ...)
2026-11-08 8:58 ` [PATCH 06/14] s390/sclp_tty: " Mike Rapoport (Microsoft)
@ 2026-11-08 8:58 ` Mike Rapoport (Microsoft)
2026-11-08 8:58 ` [PATCH 08/14] s390/sclp_sdias: " Mike Rapoport (Microsoft)
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-11-08 8:58 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
Cc: Christian Borntraeger, David Hildenbrand, Mike Rapoport,
Sven Schnelle, Vlastimil Babka, linux-s390, linux-kernel,
linux-mm
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
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
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 98e334724a627..bfbac6dfa053d 100644
--- a/drivers/s390/char/sclp.c
+++ b/drivers/s390/char/sclp.c
@@ -20,6 +20,7 @@
#include <linux/jiffies.h>
#include <linux/init.h>
#include <linux/platform_device.h>
+#include <linux/slab.h>
#include <asm/types.h>
#include <asm/irq.h>
#include <asm/debug.h>
@@ -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
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH 08/14] s390/sclp_sdias: Replace __get_free_page() with kmalloc()
2026-11-08 8:58 [PATCH 00/14] s390/sclp: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
` (6 preceding siblings ...)
2026-11-08 8:58 ` [PATCH 07/14] s390/sclp: Replace __get_free_page() with kmalloc() Mike Rapoport (Microsoft)
@ 2026-11-08 8:58 ` Mike Rapoport (Microsoft)
2026-11-08 8:58 ` [PATCH 09/14] s390/sclp_sd: " Mike Rapoport (Microsoft)
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-11-08 8:58 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
Cc: Christian Borntraeger, David Hildenbrand, Mike Rapoport,
Sven Schnelle, Vlastimil Babka, linux-s390, linux-kernel,
linux-mm
sclp_sdias_init() allocates the SCCB used for the SCLP store dump
information requests.
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_free_page() with kmalloc() and free_page() with
kfree().
Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
drivers/s390/char/sclp_sdias.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/s390/char/sclp_sdias.c b/drivers/s390/char/sclp_sdias.c
index ab8f1b758a1a8..a1a17a9e4a910 100644
--- a/drivers/s390/char/sclp_sdias.c
+++ b/drivers/s390/char/sclp_sdias.c
@@ -10,6 +10,7 @@
#include <linux/completion.h>
#include <linux/sched.h>
+#include <linux/slab.h>
#include <asm/sclp.h>
#include <asm/debug.h>
#include <asm/ipl.h>
@@ -258,7 +259,7 @@ int __init sclp_sdias_init(void)
{
if (!is_ipl_type_dump())
return 0;
- sclp_sdias_sccb = (void *) __get_free_page(GFP_KERNEL | GFP_DMA);
+ sclp_sdias_sccb = kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
BUG_ON(!sclp_sdias_sccb);
sdias_dbf = debug_register("dump_sdias", 4, 1, 4 * sizeof(long));
debug_register_view(sdias_dbf, &debug_sprintf_view);
@@ -268,7 +269,7 @@ int __init sclp_sdias_init(void)
if (sclp_sdias_init_async() == 0)
goto out;
TRACE("init failed\n");
- free_page((unsigned long) sclp_sdias_sccb);
+ kfree(sclp_sdias_sccb);
return -ENODEV;
out:
TRACE("init done\n");
--
2.53.0
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH 09/14] s390/sclp_sd: Replace __get_free_page() with kmalloc()
2026-11-08 8:58 [PATCH 00/14] s390/sclp: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
` (7 preceding siblings ...)
2026-11-08 8:58 ` [PATCH 08/14] s390/sclp_sdias: " Mike Rapoport (Microsoft)
@ 2026-11-08 8:58 ` Mike Rapoport (Microsoft)
2026-11-08 8:58 ` [PATCH 10/14] s390/sclp_cmd: Replace page allocator calls with kzalloc() Mike Rapoport (Microsoft)
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-11-08 8:58 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
Cc: Christian Borntraeger, David Hildenbrand, Mike Rapoport,
Sven Schnelle, Vlastimil Babka, linux-s390, linux-kernel,
linux-mm
sclp_sd_store_data() allocates the SCCB used for the SCLP store data
requests.
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.
While on it, pass the SCCB to sclp_sd_sync() as a typed pointer instead
of an unsigned long.
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
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
drivers/s390/char/sclp_sd.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/s390/char/sclp_sd.c b/drivers/s390/char/sclp_sd.c
index c62b2eacdc131..cc0b4481e2bed 100644
--- a/drivers/s390/char/sclp_sd.c
+++ b/drivers/s390/char/sclp_sd.c
@@ -173,7 +173,7 @@ static struct sclp_register sclp_sd_register = {
/**
* sclp_sd_sync() - Perform Store Data request synchronously
- * @page: Address of work page - must be below 2GB
+ * @sccb: Address of work SCCB - must be below 2GB
* @eq: Input EQ value
* @di: Input DI value
* @sat: Input SAT value
@@ -186,10 +186,9 @@ static struct sclp_register sclp_sd_register = {
* Return %0 on success and store resulting DSIZE and ESIZE values in
* @dsize_ptr and @esize_ptr (if provided). Return non-zero on error.
*/
-static int sclp_sd_sync(unsigned long page, u8 eq, u8 di, u64 sat, u64 sa,
+static int sclp_sd_sync(struct sclp_sd_sccb *sccb, u8 eq, u8 di, u64 sat, u64 sa,
u32 *dsize_ptr, u32 *esize_ptr)
{
- struct sclp_sd_sccb *sccb = (void *) page;
struct sclp_sd_listener listener;
struct sclp_sd_evbuf *evbuf;
int rc;
@@ -291,17 +290,18 @@ static int sclp_sd_sync(unsigned long page, u8 eq, u8 di, u64 sat, u64 sa,
*/
static int sclp_sd_store_data(struct sclp_sd_data *result, u8 di)
{
+ struct sclp_sd_sccb *sccb;
u32 dsize = 0, esize = 0;
- unsigned long page, asce = 0;
+ unsigned long asce = 0;
void *data = NULL;
int rc;
- page = __get_free_page(GFP_KERNEL | GFP_DMA);
- if (!page)
+ sccb = kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
+ if (!sccb)
return -ENOMEM;
/* Get size */
- rc = sclp_sd_sync(page, SD_EQ_SIZE, di, 0, 0, &dsize, &esize);
+ rc = sclp_sd_sync(sccb, SD_EQ_SIZE, di, 0, 0, &dsize, &esize);
if (rc)
goto out;
if (dsize == 0)
@@ -323,12 +323,12 @@ static int sclp_sd_store_data(struct sclp_sd_data *result, u8 di)
}
/* Get data */
- rc = sclp_sd_sync(page, SD_EQ_STORE_DATA, di, asce, (u64) data, &dsize,
+ rc = sclp_sd_sync(sccb, SD_EQ_STORE_DATA, di, asce, (u64) data, &dsize,
&esize);
if (rc) {
/* Cancel running request if interrupted or timed out */
if (rc == -ERESTARTSYS || rc == -ETIME) {
- if (sclp_sd_sync(page, SD_EQ_HALT, di, 0, 0, NULL, NULL)) {
+ if (sclp_sd_sync(sccb, SD_EQ_HALT, di, 0, 0, NULL, NULL)) {
pr_warn("Could not stop Store Data request - leaking at least %zu bytes\n",
(size_t)dsize * PAGE_SIZE);
data = NULL;
@@ -346,7 +346,7 @@ static int sclp_sd_store_data(struct sclp_sd_data *result, u8 di)
out:
base_asce_free(asce);
- free_page(page);
+ kfree(sccb);
return rc;
}
--
2.53.0
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH 10/14] s390/sclp_cmd: Replace page allocator calls with kzalloc()
2026-11-08 8:58 [PATCH 00/14] s390/sclp: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
` (8 preceding siblings ...)
2026-11-08 8:58 ` [PATCH 09/14] s390/sclp_sd: " Mike Rapoport (Microsoft)
@ 2026-11-08 8:58 ` Mike Rapoport (Microsoft)
2026-11-08 8:58 ` [PATCH 11/14] s390/sclp_cpi: Replace get_zeroed_page() " Mike Rapoport (Microsoft)
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-11-08 8:58 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
Cc: Christian Borntraeger, David Hildenbrand, Mike Rapoport,
Sven Schnelle, Vlastimil Babka, linux-s390, linux-kernel,
linux-mm
_sclp_get_core_info(), do_chp_configure() and sclp_chp_read_info()
allocate the SCCBs used to read the CPU information, to configure a
channel path and to read the channel path information.
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.
While on it, allocate only the amount of memory the SCCB actually
requires in _sclp_get_core_info() rather than rounding it up to the next
power of two. An SCCB must be page aligned and kmalloc() guarantees that
the alignment of an allocation is at least its largest power of two
divisor, so the extended SCCB is still page aligned.
Replace use of __get_free_pages() and get_zeroed_page() with kzalloc()
and free_page[s]() with kfree().
Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
drivers/s390/char/sclp_cmd.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c
index 1dc93d945be6f..6aaf1f6a3633f 100644
--- a/drivers/s390/char/sclp_cmd.c
+++ b/drivers/s390/char/sclp_cmd.c
@@ -102,7 +102,7 @@ int _sclp_get_core_info(struct sclp_core_info *info)
return -EOPNOTSUPP;
length = test_facility(140) ? EXT_SCCB_READ_CPU : PAGE_SIZE;
- sccb = (void *)__get_free_pages(GFP_KERNEL | GFP_DMA | __GFP_ZERO, get_order(length));
+ sccb = kzalloc(length, GFP_KERNEL | GFP_DMA);
if (!sccb)
return -ENOMEM;
sccb->header.length = length;
@@ -119,7 +119,7 @@ int _sclp_get_core_info(struct sclp_core_info *info)
}
sclp_fill_core_info(info, sccb);
out:
- free_pages((unsigned long)sccb, get_order(length));
+ kfree(sccb);
return rc;
}
@@ -173,7 +173,7 @@ static int do_chp_configure(sclp_cmdw_t cmd)
if (!SCLP_HAS_CHP_RECONFIG)
return -EOPNOTSUPP;
- sccb = (struct chp_cfg_sccb *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+ sccb = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
if (!sccb)
return -ENOMEM;
sccb->header.length = sizeof(*sccb);
@@ -193,7 +193,7 @@ static int do_chp_configure(sclp_cmdw_t cmd)
break;
}
out:
- free_page((unsigned long)sccb);
+ kfree(sccb);
return rc;
}
@@ -236,7 +236,7 @@ int sclp_chp_read_info(struct sclp_chp_info *info)
if (!SCLP_HAS_CHP_INFO)
return -EOPNOTSUPP;
- sccb = (struct chp_info_sccb *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+ sccb = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
if (!sccb)
return -ENOMEM;
sccb->header.length = sizeof(*sccb);
@@ -253,6 +253,6 @@ int sclp_chp_read_info(struct sclp_chp_info *info)
memcpy(info->standby, sccb->standby, SCLP_CHP_INFO_MASK_SIZE);
memcpy(info->configured, sccb->configured, SCLP_CHP_INFO_MASK_SIZE);
out:
- free_page((unsigned long)sccb);
+ kfree(sccb);
return rc;
}
--
2.53.0
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH 11/14] s390/sclp_cpi: Replace get_zeroed_page() with kzalloc()
2026-11-08 8:58 [PATCH 00/14] s390/sclp: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
` (9 preceding siblings ...)
2026-11-08 8:58 ` [PATCH 10/14] s390/sclp_cmd: Replace page allocator calls with kzalloc() Mike Rapoport (Microsoft)
@ 2026-11-08 8:58 ` Mike Rapoport (Microsoft)
2026-11-08 8:58 ` [PATCH 12/14] s390/sclp_ftp: " Mike Rapoport (Microsoft)
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-11-08 8:58 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
Cc: Christian Borntraeger, David Hildenbrand, Mike Rapoport,
Sven Schnelle, Vlastimil Babka, linux-s390, linux-kernel,
linux-mm
cpi_prepare_req() allocates the SCCB used to send the control program
identification to the SCLP.
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) <rppt@kernel.org>
---
drivers/s390/char/sclp_cpi_sys.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/s390/char/sclp_cpi_sys.c b/drivers/s390/char/sclp_cpi_sys.c
index b80f73fa1e01b..8bca2cdb34c10 100644
--- a/drivers/s390/char/sclp_cpi_sys.c
+++ b/drivers/s390/char/sclp_cpi_sys.c
@@ -84,7 +84,7 @@ static struct sclp_req *cpi_prepare_req(void)
req = kzalloc_obj(struct sclp_req);
if (!req)
return ERR_PTR(-ENOMEM);
- sccb = (struct cpi_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
+ sccb = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
if (!sccb) {
kfree(req);
return ERR_PTR(-ENOMEM);
@@ -118,7 +118,7 @@ static struct sclp_req *cpi_prepare_req(void)
static void cpi_free_req(struct sclp_req *req)
{
- free_page((unsigned long) req->sccb);
+ kfree(req->sccb);
kfree(req);
}
--
2.53.0
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH 12/14] s390/sclp_ftp: Replace get_zeroed_page() with kzalloc()
2026-11-08 8:58 [PATCH 00/14] s390/sclp: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
` (10 preceding siblings ...)
2026-11-08 8:58 ` [PATCH 11/14] s390/sclp_cpi: Replace get_zeroed_page() " Mike Rapoport (Microsoft)
@ 2026-11-08 8:58 ` Mike Rapoport (Microsoft)
2026-11-08 8:58 ` [PATCH 13/14] s390/sclp_mem: Replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
2026-11-08 8:58 ` [PATCH 14/14] s390/sclp_ap: Replace get_zeroed_page() with kzalloc() Mike Rapoport (Microsoft)
13 siblings, 0 replies; 15+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-11-08 8:58 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
Cc: Christian Borntraeger, David Hildenbrand, Mike Rapoport,
Sven Schnelle, Vlastimil Babka, linux-s390, linux-kernel,
linux-mm
sclp_ftp_et7() allocates the SCCB used for an HMC file transfer request
and sclp_ftp_startup() allocates the SCCB used to read the SCLP info in
the debug code.
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_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) <rppt@kernel.org>
---
drivers/s390/char/sclp_ftp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/s390/char/sclp_ftp.c b/drivers/s390/char/sclp_ftp.c
index 853492d53953c..c46fd056e9daf 100644
--- a/drivers/s390/char/sclp_ftp.c
+++ b/drivers/s390/char/sclp_ftp.c
@@ -93,7 +93,7 @@ static int sclp_ftp_et7(const struct hmcdrv_ftp_cmdspec *ftp)
int rc;
req = kzalloc_obj(*req);
- sccb = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
+ sccb = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
if (!req || !sccb) {
rc = -ENOMEM;
goto out_free;
@@ -155,7 +155,7 @@ static int sclp_ftp_et7(const struct hmcdrv_ftp_cmdspec *ftp)
}
out_free:
- free_page((unsigned long) sccb);
+ kfree(sccb);
kfree(req);
return rc;
}
@@ -250,7 +250,7 @@ int sclp_ftp_startup(void)
return rc;
#ifdef DEBUG
- info = get_zeroed_page(GFP_KERNEL);
+ info = (unsigned long)kzalloc(PAGE_SIZE, GFP_KERNEL);
if (info != 0) {
struct sysinfo_2_2_2 *info222 = (struct sysinfo_2_2_2 *)info;
@@ -262,7 +262,7 @@ int sclp_ftp_startup(void)
info222->lpar_number, info222->name);
}
- free_page(info);
+ kfree((void *)info);
}
#endif /* DEBUG */
return 0;
--
2.53.0
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH 13/14] s390/sclp_mem: Replace page allocator calls with k[mz]alloc()
2026-11-08 8:58 [PATCH 00/14] s390/sclp: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
` (11 preceding siblings ...)
2026-11-08 8:58 ` [PATCH 12/14] s390/sclp_ftp: " Mike Rapoport (Microsoft)
@ 2026-11-08 8:58 ` Mike Rapoport (Microsoft)
2026-11-08 8:58 ` [PATCH 14/14] s390/sclp_ap: Replace get_zeroed_page() with kzalloc() Mike Rapoport (Microsoft)
13 siblings, 0 replies; 15+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-11-08 8:58 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
Cc: Christian Borntraeger, David Hildenbrand, Mike Rapoport,
Sven Schnelle, Vlastimil Babka, linux-s390, linux-kernel,
linux-mm
do_assign_storage(), sclp_attach_storage() and sclp_setup_memory()
allocate the SCCBs used to assign, attach and query standby memory.
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_zeroed_page() with kzalloc(), __get_free_page() with
kmalloc() and free_page() with kfree().
Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
drivers/s390/char/sclp_mem.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/s390/char/sclp_mem.c b/drivers/s390/char/sclp_mem.c
index 6df1926d4c62a..c28460598d385 100644
--- a/drivers/s390/char/sclp_mem.c
+++ b/drivers/s390/char/sclp_mem.c
@@ -84,7 +84,7 @@ static int do_assign_storage(sclp_cmdw_t cmd, u16 rn)
struct assign_storage_sccb *sccb;
int rc;
- sccb = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+ sccb = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
if (!sccb)
return -ENOMEM;
sccb->header.length = PAGE_SIZE;
@@ -103,7 +103,7 @@ static int do_assign_storage(sclp_cmdw_t cmd, u16 rn)
break;
}
out:
- free_page((unsigned long)sccb);
+ kfree(sccb);
return rc;
}
@@ -130,7 +130,7 @@ static int sclp_attach_storage(u8 id)
struct attach_storage_sccb *sccb;
int rc, i;
- sccb = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+ sccb = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
if (!sccb)
return -ENOMEM;
sccb->header.length = PAGE_SIZE;
@@ -152,7 +152,7 @@ static int sclp_attach_storage(u8 id)
break;
}
out:
- free_page((unsigned long)sccb);
+ kfree(sccb);
return rc;
}
@@ -487,7 +487,7 @@ static int __init sclp_setup_memory(void)
if ((sclp.facilities & 0xe00000000000UL) != 0xe00000000000UL)
return 0;
rc = -ENOMEM;
- sccb = (void *)__get_free_page(GFP_KERNEL | GFP_DMA);
+ sccb = kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
if (!sccb)
goto out;
assigned = 0;
@@ -530,7 +530,7 @@ static int __init sclp_setup_memory(void)
insert_increment(0, 1, 0);
rc = sclp_init_mem();
out:
- free_page((unsigned long)sccb);
+ kfree(sccb);
return rc;
}
__initcall(sclp_setup_memory);
--
2.53.0
^ permalink raw reply [flat|nested] 15+ messages in thread* [PATCH 14/14] s390/sclp_ap: Replace get_zeroed_page() with kzalloc()
2026-11-08 8:58 [PATCH 00/14] s390/sclp: replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
` (12 preceding siblings ...)
2026-11-08 8:58 ` [PATCH 13/14] s390/sclp_mem: Replace page allocator calls with k[mz]alloc() Mike Rapoport (Microsoft)
@ 2026-11-08 8:58 ` Mike Rapoport (Microsoft)
13 siblings, 0 replies; 15+ messages in thread
From: Mike Rapoport (Microsoft) @ 2026-11-08 8:58 UTC (permalink / raw)
To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev
Cc: Christian Borntraeger, David Hildenbrand, Mike Rapoport,
Sven Schnelle, Vlastimil Babka, linux-s390, linux-kernel,
linux-mm
do_ap_configure() allocates the SCCB used to configure and deconfigure
AP adapters.
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) <rppt@kernel.org>
---
drivers/s390/char/sclp_ap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/s390/char/sclp_ap.c b/drivers/s390/char/sclp_ap.c
index 18bb018b4e0cd..15dff5dc0cac5 100644
--- a/drivers/s390/char/sclp_ap.c
+++ b/drivers/s390/char/sclp_ap.c
@@ -26,7 +26,7 @@ static int do_ap_configure(sclp_cmdw_t cmd, u32 apid)
if (!SCLP_HAS_AP_RECONFIG)
return -EOPNOTSUPP;
- sccb = (struct ap_cfg_sccb *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
+ sccb = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
if (!sccb)
return -ENOMEM;
@@ -45,7 +45,7 @@ static int do_ap_configure(sclp_cmdw_t cmd, u32 apid)
break;
}
out:
- free_page((unsigned long) sccb);
+ kfree(sccb);
return rc;
}
--
2.53.0
^ permalink raw reply [flat|nested] 15+ messages in thread