mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-21 22:47:51 -04:00
s390/hvc_iucv: Replace get_zeroed_page() with kzalloc()
hvc_iucv_alloc() allocates a send staging buffer for accumulating outbound terminal characters before they are copied into a separate IUCV message buffer for transmission to the hypervisor. The staging buffer itself is never passed to any IUCV function. 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 Reviewed-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
This commit is contained in:
committed by
Alexander Gordeev
parent
50548b7077
commit
ff289e0448
@@ -1060,7 +1060,7 @@ static int __init hvc_iucv_alloc(int id, unsigned int is_console)
|
||||
INIT_DELAYED_WORK(&priv->sndbuf_work, hvc_iucv_sndbuf_work);
|
||||
init_waitqueue_head(&priv->sndbuf_waitq);
|
||||
|
||||
priv->sndbuf = (void *) get_zeroed_page(GFP_KERNEL);
|
||||
priv->sndbuf = kzalloc(PAGE_SIZE, GFP_KERNEL);
|
||||
if (!priv->sndbuf) {
|
||||
kfree(priv);
|
||||
return -ENOMEM;
|
||||
@@ -1103,7 +1103,7 @@ static int __init hvc_iucv_alloc(int id, unsigned int is_console)
|
||||
out_error_dev:
|
||||
hvc_remove(priv->hvc);
|
||||
out_error_hvc:
|
||||
free_page((unsigned long) priv->sndbuf);
|
||||
kfree(priv->sndbuf);
|
||||
kfree(priv);
|
||||
|
||||
return rc;
|
||||
@@ -1116,7 +1116,7 @@ static void __init hvc_iucv_destroy(struct hvc_iucv_private *priv)
|
||||
{
|
||||
hvc_remove(priv->hvc);
|
||||
device_unregister(priv->dev);
|
||||
free_page((unsigned long) priv->sndbuf);
|
||||
kfree(priv->sndbuf);
|
||||
kfree(priv);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user