Thread (6 messages) flat view 6 messages, 5 authors, 2025-09-24

Re: [PATCH bpf-next] bpf: remove is_return in struct bpf_session_run_ctx

From: Menglong Dong <hidden>
Date: 2025-09-22 14:11:00
Also in: bpf, lkml

On Mon, Sep 22, 2025 at 10:08 PM Song Liu [off-list ref] wrote:
On Mon, Sep 22, 2025 at 11:57 AM Menglong Dong [off-list ref] wrote:
quoted
The "data" in struct bpf_session_run_ctx is always 8-bytes aligned.
Therefore, we can store the "is_return" to the last bit of the "data",
which can make bpf_session_run_ctx 8-bytes aligned and save memory.
Does this really save anything? AFAICT, bpf_session_run_ctx is
only allocated on the stack. Therefore, we don't save any memory
unless there is potential risk of stack overflow.
Hi, Song. My original intention is to save the usage of the
stack to prevent potential stack overflow, especially when we
trace all the kernel functions with kprobe-multi.

The most thing for me is that the unaligned field in the struct
looks very awkward, and it consumes 8-bytes only for a bit.
OTOH, this last-bit logic is confusing and error prone. I would argue
against this type of optimization.
Ah, you are right about this part. It does make the code more
confusing :/

Thanks!
Menglong Dong
Thanks,
Song
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help