From: Jim Cromie <jim.cromie@gmail.com>
To: linux-mm@kvack.org
Cc: gregkh@linuxfoundation.org, linux@rasmusvillemoes.dk,
Jim Cromie <jim.cromie@gmail.com>
Subject: [PATCH 0/7] WIP dyndbg diet plan, paging Dr Zram.
Date: Wed, 25 Nov 2020 12:36:19 -0700 [thread overview]
Message-ID: <20201125193626.2266995-1-jim.cromie@gmail.com> (raw)
hi all,
To celebrate a season of ritual overeating, Id like to propose a diet
plan for dynamic_debug.
dynamic-debug is carrying extra weight/memory in the __dyndbg linker
section, which is basically a struct _ddebug array[]. The 5 display
oriented fields carry hierarchical data, and since the linker section
is ordered, there is lots of repetition in .module .file .function
fields.
This patch-set:
1) splits struct _ddebug in 2, creating creating _ddebug_callsites
with 5 display-fields, which are placed in a new linker section.
while this adds indirection, it lets us manage storage of the .site
data, letting us keep the bulk of it in compressed form.
2,3) explores run-length-encoding as one alternative to zram,
basically throwaway, but for any ensuing discussion.
4) do kconfig bits - needs work
5) at late-init, copy site recs into zram (and save to .zhandle),
thereafter .site is "refilled" (when null) from the .zhandle.
Updating the _ddebug.site pointers also means we forget the link-time
refs to _callsites section, allowing its reclaim later (once I know
how).
The .site "refill" is by _getsite(); the corresponding _putsite()
works: it zs_unmaps ASAP and zeros .site. This means that every
pr_debug will map/unmap once, and `cat control` will do so per line.
Probably too expensive.
But it works. Im seeing 3 pages_per_zspage, on entire section.
6) a hot locking mess. well, maybe not. plenty of uncertainty though.
7) does not work. It changes _putsite() to keep each zs_mapping when
the pr_debug is enabled. But it panics in late-init, with BUG
sleeping in atomic context. ? dynamic_emit_prefix is in backtrace.
disabling all pr_debugs (--kopt \*.dyndbg=-p) gets to root prompt.
once there:
echo module main +m > /proc/dynamic_debug/control # is ok
echo module main +p > /proc/dynamic_debug/control # BUG sleeping invalid context
This strongly implicates the dynamic_emit_prefix call chain. It
puzzles me that keeping the zs_mapping would cause so much trouble;
its not causing more pr_debugs, and they should all be mapped already.
But I really dont know what Im doing here..
WAG at possible memory savings:
- add 2 pointers (zhandle, site) 56+16
- drop 48 (sizeof _callsite) * num-pr-debugs linker section
- replace with 3:1 storage on same
- 48 bytes per enabled pr_debug, typically <1% of set
IE:
dyndbg: 216 modules, 2058 entries and 8640 bytes in ddebug tables, 115248 bytes in __dyndbg section
VS:
dyndbg: 224 modules, 2015 entries and 8960 bytes in ddebug tables, 80600 bytes in __dyndbg section, 80600 bytes in __dyndbg_callsites section
dyndbg: 2015 entries. repeated entries: 1790 module 1668 file 810 func
Once __dyndbg_callsites section is reclaimed, %30 savings looks likely.
Jim Cromie (7):
dyndbg: move struct _ddebug's display fields to new _ddebug_callsite
dyndbg: count repetition in __dyndbg_callsite fields.
dyndbg: add some code to see alignments of linkage data
dyndbg: select ZPOOL,ZS_MALLOC in Kconfig.debug DYNAMIC_DEBUG_CORE
dyndbg: replace __dyndbg_callsite section with a zs-pool copy.
dyndbg: add locking around zpool-add loop in zpool-init
dyndbg: enable 'cache' of active pr_debug callsites
include/asm-generic/vmlinux.lds.h | 4 +
include/linux/dynamic_debug.h | 42 ++++--
lib/Kconfig.debug | 2 +
lib/dynamic_debug.c | 242 +++++++++++++++++++++++++-----
4 files changed, 239 insertions(+), 51 deletions(-)
To: linux-mm@kvack.org
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
--
2.28.0
next reply other threads:[~2020-11-25 19:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-25 19:36 Jim Cromie [this message]
2020-11-25 19:36 ` [PATCH 1/7] dyndbg: move struct _ddebug's display fields to new _ddebug_callsite Jim Cromie
2020-11-25 19:36 ` [PATCH 2/7] dyndbg: count repetition in __dyndbg_callsite fields Jim Cromie
2020-11-25 19:36 ` [PATCH 3/7] dyndbg: add some code to see alignments of linkage data Jim Cromie
2020-11-25 19:36 ` [PATCH 4/7] dyndbg: select ZPOOL,ZS_MALLOC in Kconfig.debug DYNAMIC_DEBUG_CORE Jim Cromie
2020-11-25 19:36 ` [PATCH 5/7] dyndbg: replace __dyndbg_callsite section with a zs-pool copy Jim Cromie
2020-11-25 19:36 ` [PATCH 6/7] dyndbg: add locking around zpool-add loop in zpool-init Jim Cromie
2020-11-25 19:36 ` [PATCH 7/7] dyndbg: enable 'cache' of active pr_debug callsites Jim Cromie
2020-11-25 20:54 ` Jason Baron
2020-11-25 21:23 ` jim.cromie
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=20201125193626.2266995-1-jim.cromie@gmail.com \
--to=jim.cromie@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-mm@kvack.org \
--cc=linux@rasmusvillemoes.dk \
/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