mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
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>
This commit is contained in:
parent
495bc70aa3
commit
16679621ef
|
|
@ -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 @@ tty3270_create_view(int index, struct tty3270 **newtp)
|
|||
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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user