[PATCH 0/5] Don't use mmap_cache subsystem in unwind-libdw

Masatake YAMATO yamato at redhat.com
Sun Apr 29 21:45:35 UTC 2018

libdw.so has a feature to cache the memory mapping of a target.
unwind-libdw uses both mmap_cache subsystem and the feature libdw.so
providing. A strace process maintains the cache data for the memory
mapping in the two different places. That is just waste of resources.

As ldv suggested in the mailing list, unwind-libdw doesn't need the
full set of the features the mmap_cache subsystem providing. What
unwind-libdw needs is the way to know the change of the memory
mapping. On the other hand, unwind-libunwind needs the full set of

This patch set does five things:

(1) introduce mmap_notify subsystem, a spin off of the mmap_cache
(2) make the mmap_cache subsystem use the mmap_notify subsystem,
(3) make unwind subsystem not use the mmap_cache subsystem directly,
(4) make unwind-libunwind use the mmap_cache subsystem directly, and
(5) make unwind-libdw use the mmap_notify subsystem only.

(5) solves the original issue.

Here is the structure this patch set proposes:

	|            unwind subsys            |
	| unwind-libunwind |   unwind-libdw   |
	|    mmap_cache    |                  |
	+------------------+                  |
	|               mmap_notify           |
	|                syscall              |

NOTE: The mmap_cache and the mmap_notify subsystem is not optimized
enough yet. Consider strace traces two threads T0 and T1.  The
mmap_cache subsystem updates the cache of the memory mapping of T1
whenever T0 calls syscalls changing the mapping of T0.

This is desirable if T0 and T1 share the same virtual address space.
However, this is undesirable if T0 and T1 don't share it.

Masatake YAMATO (5):
  mmap_notify: new subsystem for tracking the changes of memory mappings
  mmap_cache: use the mmap_notify subsystem
  mmap_notify: rename sys_flags for tracking memory mapping
  unwind-libdw: introduce indirect data structure for storing unwinding
  unwind-libdw: use the mmap_notify subsystem

 Makefile.am             |  2 ++
 mmap_cache.c            | 36 +++++++++++---------
 mmap_cache.h            |  3 --
 mmap_notify.c           | 54 +++++++++++++++++++++++++++++
 mmap_notify.h           | 39 +++++++++++++++++++++
 syscall.c               |  8 ++---
 sysent.h                |  2 +-
 sysent_shorthand_defs.h |  2 +-
 unwind-libdw.c          | 90 +++++++++++++++++++++++++++++++++----------------
 unwind-libunwind.c      | 33 ++++++++++++++----
 unwind.c                | 34 ++++---------------
 unwind.h                |  6 ----
 12 files changed, 213 insertions(+), 96 deletions(-)
 create mode 100644 mmap_notify.c
 create mode 100644 mmap_notify.h


More information about the Strace-devel mailing list