Re: [RFC 06/10] Reclaim memory from blocked kernel stacks

From: Steven Rostedt

Date: Fri Aug 28 2026 - 15:13:02 EST


On Fri, 28 Aug 2026 15:08:36 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> If you want to see how big your stack is and where its used, you can run
> the stack tracer:
>
> # trace-cmd stack --start
>
> [wait]
>
> # trace-cmd stack
> (stack tracer running)
> Depth Size Location (41 entries)
> ----- ---- --------
> 0) 5032 48 choose_idle_cpu+0x5/0x100
> 1) 4984 296 select_task_rq_fair+0xa84/0x2b40
> 2) 4688 104 try_to_wake_up+0x168/0x7e0
> 3) 4584 16 task_work_add+0xd7/0xf0
> 4) 4568 16 io_req_normal_work_add+0x75/0xb0
> 5) 4552 40 io_poll_wake+0x10f/0x160
> 6) 4512 64 __wake_up_common+0x72/0xa0
> 7) 4448 40 __wake_up_sync_key+0x43/0x60
> 8) 4408 24 sock_def_readable+0x46/0xe0
> 9) 4384 80 tun_net_xmit+0x240/0x550 [tun]
> 10) 4304 80 dev_hard_start_xmit+0x63/0x1e0
> 11) 4224 256 __dev_queue_xmit+0x880/0x10b0
> 12) 3968 24 br_dev_queue_push_xmit+0x62/0xf0 [bridge]
> 13) 3944 80 br_dev_xmit+0x15e/0x4a0 [bridge]
> 14) 3864 80 dev_hard_start_xmit+0x63/0x1e0
> 15) 3784 256 __dev_queue_xmit+0x880/0x10b0
> 16) 3528 72 ip_finish_output2+0x2ce/0x650
> 17) 3456 104 ip_output+0x63/0x110
> 18) 3352 72 __ip_queue_xmit+0x16f/0x470
> 19) 3280 232 __tcp_transmit_skb+0xcb5/0x1140
> 20) 3048 120 tcp_write_xmit+0x5aa/0x1760
> 21) 2928 24 __tcp_push_pending_frames+0x39/0x110
> 22) 2904 104 tcp_rcv_established+0x37f/0xeb0
> 23) 2800 32 tcp_v4_do_rcv+0x13f/0x300
> 24) 2768 168 tcp_v4_rcv+0xc01/0x1300
> 25) 2600 48 ip_protocol_deliver_rcu+0x35/0x1b0
> 26) 2552 24 ip_local_deliver_finish+0x85/0x100
> 27) 2528 40 __netif_receive_skb_one_core+0x85/0xa0
> 28) 2488 56 netif_receive_skb+0x127/0x180
> 29) 2432 104 br_handle_frame_finish+0x428/0x680 [bridge]
> 30) 2328 40 br_handle_frame+0x132/0x2a0 [bridge]
> 31) 2288 280 __netif_receive_skb_core.constprop.0+0x16e/0xdf0
> 32) 2008 40 __netif_receive_skb_one_core+0x39/0xa0
> 33) 1968 56 netif_receive_skb+0x127/0x180
> 34) 1912 256 tun_get_user+0xbd0/0x1260 [tun]
> 35) 1656 56 tun_chr_write_iter+0x77/0xba [tun]
> 36) 1600 88 do_iter_readv_writev+0x161/0x260
> 37) 1512 256 vfs_writev+0x168/0x3c0
> 38) 1256 80 do_writev+0x7f/0x110

> 39) 1176 984 do_syscall_64+0xaa/0x670

If one worries about stack size, they may want to turn off
CONFIG_RANDOMIZE_KSTACK_OFFSET as I see some big numbers for do_syscall_64()

-- Steve


> 40) 192 192 entry_SYSCALL_64_after_hwframe+0x76/0x7e