From: Ihor Solodrai <ihor.solodrai@linux.dev>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Song Liu <song@kernel.org>
Cc: bpf@vger.kernel.org, kernel-team@meta.com
Subject: Re: [PATCH bpf-next v2] bpf: Better build_id caching in stack_map_get_build_id_offset()
Date: Fri, 12 Jun 2026 21:38:03 -0700 [thread overview]
Message-ID: <6d5db6af-1dc7-49de-aec1-8f06dc5f3416@linux.dev> (raw)
In-Reply-To: <DJ7JIJEZ333Z.28J0XFPQ1RAFC@gmail.com>
On 6/12/26 6:45 PM, Alexei Starovoitov wrote:
> On Fri Jun 12, 2026 at 3:06 PM PDT, Ihor Solodrai wrote:
>> +static void stack_map_build_id_cache_set_resolved(struct stack_map_build_id_cache *cache,
>> + struct file *file,
>> + const unsigned char *build_id,
>> + unsigned long vm_start,
>> + unsigned long vm_end,
>> + unsigned long vm_pgoff)
>> +{
>> + if (cache->resolved.file)
>> + fput(cache->resolved.file);
>> + cache->resolved.file = file;
>> + cache->resolved.build_id = build_id;
>> + cache->resolved.vm_start = vm_start;
>> + cache->resolved.vm_end = vm_end;
>> + cache->resolved.vm_pgoff = vm_pgoff;
>> +}
>
> sorry for broken record.
> claude's copy paste doesn't bother you?
tbh, this particular block is fine with me, it's certainly
not as bad as big expressions in the conditions that I rewrote
in the other helper. I guess I'm just used to lengthy qualified
expressions from my java days, so it doesn't bother me much
(maybe it should).
I briefly chatted with Eduard off-list about this, and I agree
with him that what makes this patch awkward is anonymous structs
as cache fields. I'll try something else in v3.
> It could have been:
>
> struct resolved *res = &cache->resolved;
> if (res->file)
> fput(res->file);
> res->file = file;
> res->build_id = build_id;
> res->vm_start = vm_start;
> res->vm_end = vm_end;
> res->vm_pgoff = vm_pgoff;
>
> or
>
> cache->resolved = (struct resolved) { file, build_iud, vm_start, emnv_end, vm_pgoff };
>
> and probably other options to make a code easier for humans to read.
>
> You have to explictly tell claude to deduplicate otherwise it keeps
> copy pasting left and right.
I am painfully aware of claude's quirks, yes :)
prev parent reply other threads:[~2026-06-13 4:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 22:06 [PATCH bpf-next v2] bpf: Better build_id caching in stack_map_get_build_id_offset() Ihor Solodrai
2026-06-12 22:37 ` bot+bpf-ci
2026-06-12 23:59 ` Ihor Solodrai
2026-06-13 1:45 ` Alexei Starovoitov
2026-06-13 4:38 ` Ihor Solodrai [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6d5db6af-1dc7-49de-aec1-8f06dc5f3416@linux.dev \
--to=ihor.solodrai@linux.dev \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=kernel-team@meta.com \
--cc=memxor@gmail.com \
--cc=song@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.