Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH] tools: perf: allow opt-in "no-dso." files in /dev/shm
@ 2026-10-13 21:38 Stephen Brennan
  2026-10-13 21:43 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Brennan @ 2026-10-13 21:38 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Namhyung Kim, Peter Zijlstra,
	Ingo Molnar
  Cc: James Clark, linux-perf-users, Stephen Brennan, Ian Rogers,
	Mark Rutland, linux-kernel, Alexander Shishkin, Jiri Olsa,
	Adrian Hunter

Applications can place JIT-compiled code in POSIX shared memory so that
multiple processes can execute the same code. On Linux, these shared
memory objects appear as file mappings under /dev/shm.

Perf uses /tmp/perf-$pid.map to resolve symbols for executable SysV
shared memory mappings, but it treats /dev/shm mappings as ordinary
DSOs. As a result, applications which provide perf-map symbols for JIT
code in POSIX shared memory don't get those symbols resolved, while they
do with SysV shared memory.

It would be incorrect to classify every /dev/shm mapping as no-DSO
memory though, because /dev/shm is just a tmpfs mount, and it can
contain ELF files.

Add a filename prefix "/dev/shm/no-dso." which is recognized by
is_no_dso_memory(). Applications can opt-in by naming their shared
memory objects "no-dso.<name>". Executable mappings with this prefix
will use the perf-map file, while other /dev/shm mappings will keep the
existing behavior. This allows applications that already emit perf maps
to use POSIX shared memory for JIT code, without needing to implement
jitdump support.

Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com>
---
 tools/perf/util/map.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index fb0279810ae99..c2e31be232c88 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h
@@ -258,6 +258,8 @@ static inline int is_no_dso_memory(const char *filename)
 {
 	return !strncmp(filename, "[stack", 6) ||
 	       !strncmp(filename, "/SYSV", 5)  ||
+	       !strncmp(filename, "/dev/shm/no-dso.",
+	                sizeof("/dev/shm/no-dso.") - 1) ||
 	       !strcmp(filename, "[heap]");
 }
 
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tools: perf: allow opt-in "no-dso." files in /dev/shm
  2026-10-13 21:38 [PATCH] tools: perf: allow opt-in "no-dso." files in /dev/shm Stephen Brennan
@ 2026-10-13 21:43 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-10-13 21:43 UTC (permalink / raw)
  To: Stephen Brennan; +Cc: linux-perf-users

> Applications can place JIT-compiled code in POSIX shared memory so that
> multiple processes can execute the same code. On Linux, these shared
> memory objects appear as file mappings under /dev/shm.
> 
> Perf uses /tmp/perf-$pid.map to resolve symbols for executable SysV
> shared memory mappings, but it treats /dev/shm mappings as ordinary
> DSOs. As a result, applications which provide perf-map symbols for JIT
> code in POSIX shared memory don't get those symbols resolved, while they
> do with SysV shared memory.
> 
> It would be incorrect to classify every /dev/shm mapping as no-DSO
> memory though, because /dev/shm is just a tmpfs mount, and it can
> contain ELF files.
> 
> Add a filename prefix "/dev/shm/no-dso." which is recognized by
> is_no_dso_memory(). Applications can opt-in by naming their shared
> memory objects "no-dso.<name>". Executable mappings with this prefix
> will use the perf-map file, while other /dev/shm mappings will keep the
> existing behavior. This allows applications that already emit perf maps
> to use POSIX shared memory for JIT code, without needing to implement
> jitdump support.
> 
> Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261013213842.1870582-1-stephen.s.brennan@oracle.com?part=1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-13 21:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13 21:38 [PATCH] tools: perf: allow opt-in "no-dso." files in /dev/shm Stephen Brennan
2026-10-13 21:43 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox