diff options
| author | Mike Rapoport (Microsoft) <rppt@kernel.org> | 2026-05-31 17:08:22 +0300 |
|---|---|---|
| committer | Alexander Gordeev <agordeev@linux.ibm.com> | 2026-06-03 15:32:44 +0200 |
| commit | 16679621ef3f630f976af97d9e9c0b4e132041ec (patch) | |
| tree | 0c962c0dbf62d9ad08d53b7532f9e0b7692a395f | |
| parent | 495bc70aa32258c630c4f521ceadf30753f2a00b (diff) | |
| download | linux-16679621ef3f630f976af97d9e9c0b4e132041ec.tar.gz linux-16679621ef3f630f976af97d9e9c0b4e132041ec.zip | |
s390/con3270: Replace __get_free_page() with kmalloc()
con3270_alloc_view() allocates a staging buffer used to assemble
3270 datastream content before it is copied into channel program
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
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>
| -rw-r--r-- | drivers/s390/char/con3270.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/s390/char/con3270.c b/drivers/s390/char/con3270.c index 644d3679748d..c39da2ec22b4 100644 --- a/drivers/s390/char/con3270.c +++ b/drivers/s390/char/con3270.c @@ -880,7 +880,7 @@ static void tty3270_free_view(struct tty3270 *tp) raw3270_request_free(tp->kreset); raw3270_request_free(tp->read); raw3270_request_free(tp->write); - free_page((unsigned long)tp->converted_line); + kfree(tp->converted_line); tty_port_destroy(&tp->port); kfree(tp); } @@ -1063,7 +1063,7 @@ static void tty3270_free(struct raw3270_view *view) timer_delete_sync(&tp->timer); tty3270_free_screen(tp->screen, tp->allocated_lines); - free_page((unsigned long)tp->converted_line); + kfree(tp->converted_line); kfree(tp->input); kfree(tp->prompt); tty3270_free_view(tp); @@ -1121,7 +1121,7 @@ tty3270_create_view(int index, struct tty3270 **newtp) goto out_put_view; } - tp->converted_line = (void *)__get_free_page(GFP_KERNEL); + tp->converted_line = kmalloc(PAGE_SIZE, GFP_KERNEL); if (!tp->converted_line) { rc = -ENOMEM; goto out_free_screen; @@ -1167,7 +1167,7 @@ out_free_prompt: out_free_input: kfree(tp->input); out_free_converted_line: - free_page((unsigned long)tp->converted_line); + kfree(tp->converted_line); out_free_screen: tty3270_free_screen(tp->screen, tp->view.rows); out_put_view: |
