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

Dmitry V. Levin ldv at altlinux.org
Sun May 6 15:03:04 UTC 2018


On Mon, Apr 30, 2018 at 06:45:35AM +0900, Masatake YAMATO wrote:
> 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
> features.
> 
> This patch set does five things:
> 
> (1) introduce mmap_notify subsystem, a spin off of the mmap_cache
>     subsystem,
> (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              |
> 	+-------------------------------------+
>                mmap/munmap/mprotect/brk...
> 
> 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
>     context
>   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

Merged, thanks!


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20180506/0d0197db/attachment.bin>


More information about the Strace-devel mailing list