From: Xin Chen <xin.chen2@oss.qualcomm.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: jirislaby@kernel.org, linux-kernel@vger.kernel.org,
linux-serial@vger.kernel.org, liulzhao@qti.qualcomm.com,
cheng.jiang@oss.qualcomm.com
Subject: Re: [PATCH v1] tty: n_tty: use kvzalloc/kvfree for line discipline data
Date: Tue, 18 Aug 2026 14:02:43 +0800 [thread overview]
Message-ID: <066081a1-e644-4b01-86c5-e5ab908a7754@oss.qualcomm.com> (raw)
In-Reply-To: <2026081747-secret-partly-158a@gregkh>
On Mon, Aug 17, 2026, Greg KH wrote:
> Also, you are papering over the real problem here. If this one
> allocation is failing, what keeps the next one from failing and then
> the skb will not be able to be allocated?
The key difference is allocation size and allocator behavior.
vzalloc() always allocates page-by-page from the buddy order-0 free
list, so two back-to-back vzalloc() calls for ~10 KB each consume
~5 order-0 pages each, transiently depleting the order-0 free list.
kvzalloc() serves the same ~10 KB from the kmalloc-16384 slab, which
is backed by order-2 compound pages — a completely separate pool from
the order-0 pages that skb_clone(GFP_KERNEL) needs. So switching to
kvzalloc() eliminates the interference between n_tty_open() and
skb_clone().
> Why is the system so out of memory in this slab that this is
> happening? What changed in the tty layer to cause this? Or did it
> happen elsewhere?
Nothing changed recently in the tty layer. vzalloc() has been used
here since commit ebec3f8f5271 ("n_tty: Access echo_* variables
carefully.", 2018), which replaced vmalloc() with vzalloc(). The
issue surfaces only when serdev_device_open() is called multiple times
in quick succession (as happens during BT UART transport init),
triggering multiple n_tty_open() calls back-to-back. Each vzalloc()
drains order-0 pages, and the window where skb_clone() fails is
narrow but reproducible under this specific pattern. It was found
during a BT enable-disable sanity test that repeatedly cycles BT on
and off, which consistently triggers the back-to-back n_tty_open()
calls that expose the issue.
> And no cc: stable or Fixes: tag?
Both will be added in v2:
Fixes: ebec3f8f5271 ("n_tty: Access echo_* variables carefully.")
Cc: stable@vger.kernel.org
Thanks,
Xin Chen
next prev parent reply other threads:[~2026-08-18 6:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 13:55 [PATCH v1] tty: n_tty: use kvzalloc/kvfree for line discipline data Xin Chen
2026-08-17 14:14 ` Greg KH
2026-08-18 3:09 ` Xin Chen
2026-08-18 6:05 ` Greg KH
2026-08-18 6:22 ` Xin Chen
2026-08-17 14:16 ` Greg KH
2026-08-17 14:49 ` Greg KH
2026-08-18 6:02 ` Xin Chen [this message]
2026-08-18 6:34 ` Greg KH
2026-08-18 6:58 ` Xin Chen
2026-08-18 7:34 ` Greg KH
2026-08-18 3:31 ` Xin Chen
2026-08-18 6:07 ` Greg KH
2026-08-18 6:39 ` Xin Chen
2026-08-18 7:03 ` [PATCH v2] " Xin Chen
2026-08-18 7:15 ` Jiri Slaby
2026-08-18 7:23 ` Xin Chen
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=066081a1-e644-4b01-86c5-e5ab908a7754@oss.qualcomm.com \
--to=xin.chen2@oss.qualcomm.com \
--cc=cheng.jiang@oss.qualcomm.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=liulzhao@qti.qualcomm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox