From: Jiri Slaby <jirislaby@kernel.org>
To: "Mike Rapoport (Microsoft)" <rppt@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-serial@vger.kernel.org
Subject: Re: [PATCH 4/4] vc_screen: replace __get_free_pages() with kmalloc()
Date: Fri, 29 May 2026 09:47:17 +0200 [thread overview]
Message-ID: <aea14426-4ed2-4c3f-a200-bdad5a5aecca@kernel.org> (raw)
In-Reply-To: <20260528-b4-tty-v1-4-9da9f7aec5f2@kernel.org>
On 28. 05. 26, 12:24, Mike Rapoport (Microsoft) wrote:
> vcs_read() and vcs_write() allocate staging buffers with
> __get_free_pages().
>
> 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 it's a
> modern way of saying "I need a page-sized buffer"
>
> Replace use of __get_free_page() with kmalloc() and drop unused now
> DEFINE_FREE(free_page_ptr ...)
>
> Link: https://lore.kernel.org/all/700c5a5f-3128-4671-99aa-827ca73f5cdf@kernel.org
> Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> ---
> drivers/tty/vt/vc_screen.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c
> index 4d2d46c95fef..386c80efc672 100644
> --- a/drivers/tty/vt/vc_screen.c
> +++ b/drivers/tty/vt/vc_screen.c
> @@ -53,8 +53,6 @@
> #define HEADER_SIZE 4u
> #define CON_BUF_SIZE (IS_ENABLED(CONFIG_BASE_SMALL) ? 256 : PAGE_SIZE)
>
> -DEFINE_FREE(free_page_ptr, void *, if (_T) free_page((unsigned long)_T));
> -
Indeed, I don't know why I came up with this in the first place :P.
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
> @@ -371,7 +369,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
> loff_t pos;
> bool viewed, attr, uni_mode;
>
> - char *con_buf __free(free_page_ptr) = (char *)__get_free_page(GFP_KERNEL);
> + char *con_buf __free(kfree) = kmalloc(PAGE_SIZE, GFP_KERNEL);
> if (!con_buf)
> return -ENOMEM;
>
> @@ -596,7 +594,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
> if (use_unicode(inode))
> return -EOPNOTSUPP;
>
> - char *con_buf __free(free_page_ptr) = (char *)__get_free_page(GFP_KERNEL);
> + char *con_buf __free(kfree) = kmalloc(PAGE_SIZE, GFP_KERNEL);
> if (!con_buf)
> return -ENOMEM;
>
>
--
js
suse labs
prev parent reply other threads:[~2026-05-29 7:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-28 10:24 [PATCH 0/4] tty: replace __get_free_pages() with kmalloc() Mike Rapoport (Microsoft)
2026-05-28 10:24 ` [PATCH 1/4] serial: pch: replace __get_free_page() " Mike Rapoport (Microsoft)
2026-05-28 10:24 ` [PATCH 2/4] tty: amiserial: replace get_zeroed_page() with kzalloc() Mike Rapoport (Microsoft)
2026-05-28 10:24 ` [PATCH 3/4] tty: serial: men_z135_uart: replace __get_free_page() with kmalloc() Mike Rapoport (Microsoft)
2026-05-29 7:47 ` Jiri Slaby
2026-05-29 8:43 ` Mike Rapoport
2026-05-29 8:52 ` Jiri Slaby
2026-05-28 10:24 ` [PATCH 4/4] vc_screen: replace __get_free_pages() " Mike Rapoport (Microsoft)
2026-05-29 7:47 ` Jiri Slaby [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aea14426-4ed2-4c3f-a200-bdad5a5aecca@kernel.org \
--to=jirislaby@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-serial@vger.kernel.org \
--cc=rppt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.