• Jim Cromie's avatar
    dyndbg: fix overcounting of ram used by dyndbg · 81d0c2c6
    Jim Cromie authored
    during dyndbg init, verbose logging prints its ram overhead.  It
    counted strlens of struct _ddebug's 4 string members, in all callsite
    entries, which would be approximately correct if each had been
    mallocd.  But they are pointers into shared .rodata; for example, all
    10 kobject callsites have identical filename, module values.
    
    Its best not to count that memory at all, since we cannot know they
    were linked in because of CONFIG_DYNAMIC_DEBUG=y, and we want to
    report a number that reflects what ram is saved by deconfiguring it.
    
    Also fix wording and size under-reporting of the __dyndbg section.
    
    Heres my overhead, on a virtme-run VM on a fedora-31 laptop:
    
      dynamic_debug:dynamic_debug_init: 260 modules, 2479 entries \
        and 10400 bytes in ddebug tables, 138824 bytes in __dyndbg section
    
    Acked-by: <jbaron@akamai.com>
    Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
    Link: https://lore.kernel.org/r/20200719231058.1586423-7-jim.cromie@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    81d0c2c6
dynamic_debug.c 26.3 KB