From: Steven Rostedt <rostedt@goodmis.org>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Shakeel Butt <shakeel.butt@linux.dev>,
Matthew Wilcox <willy@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Muchun Song <muchun.song@linux.dev>,
Axel Rasmussen <axelrasmussen@google.com>,
Suren Baghdasaryan <surenb@google.com>,
linux-mm@kvack.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org,
Meta kernel team <kernel-team@meta.com>
Subject: Re: [PATCH] mm: mmap_lock: optimize mmap_lock tracepoints
Date: Sun, 24 Nov 2024 08:39:39 -0500 [thread overview]
Message-ID: <20241124083939.1fab4656@gandalf.local.home> (raw)
In-Reply-To: <c3eb6f05-f857-4c3d-9ef8-2488baecb00c@suse.cz>
On Sat, 23 Nov 2024 22:38:59 +0100
Vlastimil Babka <vbabka@suse.cz> wrote:
> On 11/23/24 22:35, Shakeel Butt wrote:
> > On Sat, Nov 23, 2024 at 05:01:57PM +0000, Matthew Wilcox wrote:
> >> On Fri, Nov 22, 2024 at 10:09:39PM -0800, Shakeel Butt wrote:
> >> > TP_printk(
> >> > - "mm=%p memcg_path=%s write=%s",
> >> > - __entry->mm,
> >> > - __get_str(memcg_path),
> >> > + "mm=%p memcg_id=%llu write=%s",
> >> > + __entry->mm, __entry->memcg_id,
> >> > __entry->write ? "true" : "false"
> >>
> >> Is it actually useful to print out the (hashed) pointer of the mm?
> >> Wouldn't the PID be more useful so you could actually associate it with
> >> a task?
> >>
> >
> > For our usecase i.e. bpftrace, we don't really care about these prints
> > as we can directly access the arguments like mm in bpftrace. I wonder if
> > others are using this hased pointer in some other way. I don't mind
> > chaning it but I think that would be a separate patch.
>
> I wonder if it's actually hashed when trace events are obtained in binary
> form, i.e. via trace-cmd. Might be hashed only when doing e.g. cat
> trace_pipe as that's when the kernel's printk with its hashing is used?
>
> I guess that would be another argument for not using it in the tracepoint,
> as it would be a sidechannel...
This is no more a sidechannel than /proc/kallsyms. It is only accessible
via the privileged users. It's very common and useful to show pointers in
trace events.
You can use eprobes to get information off of pointers too:
echo 'e:mmap_lock_count mmap_lock/mmap_lock_start_locking count=+0($mm):u32' > /sys/kernel/tracing/dynamic_events
and now you have an event that shows the mm_count of the mm structure.
-- Steve
prev parent reply other threads:[~2024-11-24 13:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-23 6:09 Shakeel Butt
2024-11-23 6:46 ` Yosry Ahmed
2024-11-23 21:14 ` Shakeel Butt
2024-11-23 8:38 ` Vlastimil Babka
2024-11-23 21:15 ` Shakeel Butt
2024-11-23 17:01 ` Matthew Wilcox
2024-11-23 21:35 ` Shakeel Butt
2024-11-23 21:38 ` Vlastimil Babka
2024-11-24 6:26 ` Shakeel Butt
2024-11-24 13:39 ` Steven Rostedt [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=20241124083939.1fab4656@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox