summaryrefslogtreecommitdiff
path: root/include/asm-generic/vmlinux.lds.h
diff options
context:
space:
mode:
authorJim Cromie <jim.cromie@gmail.com>2022-10-22 16:56:37 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-11-10 19:08:38 +0100
commit2f465b921bb8ff97025017e05f6c7a7a1f6a5749 (patch)
tree12b7592259fe5b1bef7f4d8424d3bd43a9d053d6 /include/asm-generic/vmlinux.lds.h
parent9b351be25360c5cedfb98b88d6dfd89327849e52 (diff)
vmlinux.lds.h: place optional header space in BOUNDED_SECTION
Extend recently added BOUNDED_SECTION(_name) macro by adding a KEEP(*(.gnu.linkonce.##_name)) before the KEEP(*(_name)). This does nothing by itself, vmlinux is the same before and after this patch. But if a developer adds a .gnu.linkonce.foo record, that record is placed in the front of the section, where it can be used as a header for the table. The intent is to create an up-link to another organizing struct, from where related tables can be referenced. And since every item in a table has a known offset from its header, that same offset can be used to fetch records from the related tables. By itself, this doesnt gain much, unless maybe the pattern of access is to scan 1 or 2 fields in each fat record, but with 2 16 bit .map* fields added, we could de-duplicate 2 related tables. The use case here is struct _ddebug, which has 3 pointers (function, file, module) with substantial repetition; respectively 53%, 90%, and the module column is fully recoverable after dynamic_debug_init() splits the table into a linked list of "module" chunks. On a DYNAMIC_DEBUG=y kernel with 5k pr_debugs, the memory savings should be ~100 KiB. Signed-off-by: Jim Cromie <jim.cromie@gmail.com> Link: https://lore.kernel.org/r/20221022225637.1406715-3-jim.cromie@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/asm-generic/vmlinux.lds.h')
-rw-r--r--include/asm-generic/vmlinux.lds.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 9f6352171f88..b3ca56ac163f 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -195,11 +195,13 @@
#define BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _s_, _e_) \
_s_##_label_ = .; \
+ KEEP(*(.gnu.linkonce.##_sec_)) \
KEEP(*(_sec_)) \
_e_##_label_ = .;
#define BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _s_, _e_) \
_label_##_s_ = .; \
+ KEEP(*(.gnu.linkonce.##_sec_)) \
KEEP(*(_sec_)) \
_label_##_e_ = .;