On Mon, Sep 22, 2025 at 10:08 PM Song Liu <[email protected]> wrote: > > On Mon, Sep 22, 2025 at 11:57 AM Menglong Dong <[email protected]> > wrote: > > > > 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
