From: Namhyung Kim <namhyung@kernel.org>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Ian Rogers <irogers@google.com>,
Kan Liang <kan.liang@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-perf-users@vger.kernel.org,
Andrii Nakryiko <andrii@kernel.org>, Song Liu <song@kernel.org>,
bpf@vger.kernel.org, Stephane Eranian <eranian@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Hyeonggon Yoo <42.hyeyoo@gmail.com>, Kees Cook <kees@kernel.org>
Subject: Re: [PATCH v2 3/4] perf lock contention: Resolve slab object name using BPF
Date: Mon, 18 Nov 2024 10:45:30 -0800 [thread overview]
Message-ID: <ZzuLSkThfgkA_8hT@google.com> (raw)
In-Reply-To: <00aa92be-85db-4163-9576-dfc71eafb415@suse.cz>
Hello,
On Wed, Nov 13, 2024 at 03:20:43PM +0100, Vlastimil Babka wrote:
> On 11/12/24 15:50, Arnaldo Carvalho de Melo wrote:
> > On Tue, Nov 12, 2024 at 12:09:24PM +0100, Vlastimil Babka wrote:
> > + /* look slab_hash for dynamic locks in a slab object */
> > + if (hashmap__find(&slab_hash, flags & LCB_F_SLAB_ID_MASK, &slab_data)) {
> > + snprintf(name_buf, sizeof(name_buf), "&%s", slab_data->name);
> > + return name_buf;
> > + }
> >
> > He wants to avoid storing 64 bytes (the slab cache pointer, 's'), instead
> > he wants to store a shorter 'id' and encode it in the upper bits of the
> > 'struct contention_data' 'flags' field.
> >
> > The iterator, at the beggining of the session attributes this id,
> > starting from zero, to each of the slab caches, so it needs to map it
> > back from the address at contention_end tracepoint.
> >
> > At post processing time it converts the id back to the name of the slab
> > cache.
> >
> > I hope this helps,
Thanks Analdo for the explanation!
>
> Thanks a lot, if it's a tradeoff to do a bit more work in order to store
> less data, then it makes sense to me.
Right, I don't want to increase the data size for this as we have some
unused bits in the flags. It'd call one more bpf hashmap lookup during
record but I don't think it's gonna be a problem.
Thanks,
Namhyung
> >
> >> - if it's postprocessing, it would be too late for bpf_get_kmem_cache() as
> >> the object might be gone already?
> >>
> >> The second alternative would be worse as it could miss the cache or
> >> misattribute (in case page is reallocated by another cache), the first is
> >> just less efficient than possible.
> >>
> >> > + }
> >> > + }
> >> >
> >> > err = bpf_map_update_elem(&lock_stat, &key, &first, BPF_NOEXIST);
> >> > if (err < 0) {
>
next prev parent reply other threads:[~2024-11-18 18:45 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-08 6:14 [PATCH v2 0/4] perf lock contention: Symbolize locks using slab cache names Namhyung Kim
2024-11-08 6:14 ` [PATCH v2 1/4] perf lock contention: Add and use LCB_F_TYPE_MASK Namhyung Kim
2024-11-08 6:14 ` [PATCH v2 2/4] perf lock contention: Run BPF slab cache iterator Namhyung Kim
2024-12-09 16:36 ` Arnaldo Carvalho de Melo
2024-12-09 16:38 ` Arnaldo Carvalho de Melo
2024-12-09 20:23 ` Arnaldo Carvalho de Melo
2024-12-09 23:00 ` Andrii Nakryiko
[not found] ` <CA+JHD91Ai_ObUye4Unz2e2Hku2BH5_+0q3HyUtf7ay23uDnkjQ@mail.gmail.com>
2024-12-10 0:23 ` Andrii Nakryiko
2024-12-09 22:16 ` Namhyung Kim
2024-12-09 22:23 ` Ian Rogers
2024-11-08 6:14 ` [PATCH v2 3/4] perf lock contention: Resolve slab object name using BPF Namhyung Kim
2024-11-12 11:09 ` Vlastimil Babka
2024-11-12 14:50 ` Arnaldo Carvalho de Melo
2024-11-13 14:20 ` Vlastimil Babka
2024-11-18 18:45 ` Namhyung Kim [this message]
2024-11-08 6:14 ` [PATCH v2 4/4] perf lock contention: Handle slab objects in -L/--lock-filter option Namhyung Kim
2024-11-11 19:46 ` [PATCH v2 0/4] perf lock contention: Symbolize locks using slab cache names Ian Rogers
2024-11-18 18:35 ` Namhyung Kim
2024-12-13 17:10 ` Namhyung Kim
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=ZzuLSkThfgkA_8hT@google.com \
--to=namhyung@kernel.org \
--cc=42.hyeyoo@gmail.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=eranian@google.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=roman.gushchin@linux.dev \
--cc=song@kernel.org \
--cc=vbabka@suse.cz \
/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.