how to return unneeded init-data to kernel ?
jim.cromie at gmail.com
jim.cromie at gmail.com
Thu Jun 3 15:05:11 EDT 2021
hi all,
When one builds with CONFIG_DYNAMIC_DEBUG=y
one consumes extra memory for kernel data
Ive managed to coax dyndbg into "not needing" about 30KiB in a
__dyndbg* section,
how can I return it to the kernel ?
https://lore.kernel.org/lkml/20210529200029.205306-1-jim.cromie@gmail.com/
b4:
dyndbg: 284 modules, 3013 entries and 11360 bytes in ddebug tables,
168728 bytes in __dyndbg section
after:
dyndbg: 2900 prdebugs in 277 modules, 12 KiB in ddebug tables, 90 KiB
in __dyndbg section, 67 KiB in __dyndbg_sites section
about 30Kib of the 67 is recoverable
patchset, the short version:
A- split __dyndbg in 2, isolate repeating module,file,function data.
reach by new .site ptr.
B- be safe if !.site
C- work towards replacing .site with indexing on vectors: __dyndbgs &
__dyndbg_sites
c1 add ._index
c2 use .index to get to __dyndbgs[0] ( then -> sites[._index] )
c3 insert header record at __dyndbgs[0]
c4 rework header to differentiate from struct _ddebug, keep .site
c5 drop .site, use indirection to get sites[._index]
D- split _index into 2 jobs; _back (to [0]) and _map (to [N])
E- find duplicate site recs
e1 - use just 1st of duplicate blocks
e2 - in modules, move new site recs into front of sites vector
e3 - in builtins, pack the whole sites vector, not just within the module-blocks
So that leaves about 40% of __dyndbg_sites unneeded.
How to return this to free memory ?
FWIW, I tried krealloc on a module's chunk of memory
(as attached by module:load_info())
it might have worked if that chunk was kallocd separately
by elf-loader code. It evidently was not.
PS: questions welcome here, reviews probably best at lkml
More information about the Kernelnewbies
mailing list