Re: [PATCH net-next 14/15 v2] net: Reference bpf_redirect_info via task_struct on PREEMPT_RT.
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: 2024-05-15 13:43:30
Also in:
bpf, lkml
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: 2024-05-15 13:43:30
Also in:
bpf, lkml
On 2024-05-14 13:54:43 [+0200], Toke Høiland-Jørgensen wrote:
quoted
--- a/include/linux/sched.h +++ b/include/linux/sched.h@@ -1504,6 +1505,8 @@ struct task_struct { /* Used for BPF run context */ struct bpf_run_ctx *bpf_ctx; #endif + /* Used by BPF for per-TASK xdp storage */ + struct bpf_net_context *bpf_net_context;Okay, so if we are going the route of always putting this in 'current', why not just embed the whole struct bpf_net_context inside task_struct, instead of mucking about with the stack-allocated structures and setting/clearing of pointers?
The whole struct bpf_net_context has 112 bytes. task_struct has 12352 bytes in my debug-config or 7296 bytes with defconfig on x86-64. Adding it unconditionally would grow task_struct by ~1% but it would make things way easier: The NULL case goes away, the assignment and cleanup goes away, the INIT_LIST_HEAD can be moved to fork(). If the size increase is not an issue then why not. Let me prepare…
-Toke
Sebastian