Re: [PATCH v2] tty: n_tty: use kvzalloc/kvfree for line discipline data
From: Xin Chen
Date: Tue Aug 18 2026 - 03:23:48 EST
On Tue, Aug 18, 2026, Jiri Slaby wrote:
> Switching from order-0 to order-2? If you ran out of vmspace on some
> 32bit platform, perhaps. But you apparently did not. So all this
> feels odd.
To clarify: the concern is not vmalloc address space exhaustion.
The issue is that vzalloc() allocates order-0 pages from the buddy
allocator via the bulk allocation path (alloc_pages_bulk_noprof),
which uses ALLOC_WMARK_LOW and does not perform direct reclaim.
When two back-to-back vzalloc() calls drain enough order-0 pages
to push the zone below the low watermark, a subsequent
skb_clone(GFP_KERNEL) in hci_send_cmd_sync() fails silently,
leaving hdev->req_skb NULL and causing BT enable to time out with
-ETIMEDOUT.
kvzalloc_obj() serves the ~10 KB n_tty_data from the kmalloc-16384
slab, which is backed by order-2 compound pages — a separate pool
that does not deplete the order-0 free list that skb_clone() depends
on. The commit message could have been clearer on this point; I will
improve it in the next version.
Thanks,
Xin Chen