)]}'
{
  "commit": "249eba75634ad76a577bcff37f84f15b1f487840",
  "tree": "c10389b58244280288db3fccdce5d98b77873a68",
  "parents": [
    "e2854a1054ab171a2c5cad6e9b7f0c580bab409d"
  ],
  "author": {
    "name": "Jessica Yu",
    "email": "jeyu@kernel.org",
    "time": "Tue Nov 12 12:35:59 2019 +0100"
  },
  "committer": {
    "name": "Jessica Yu",
    "email": "jeyu@kernel.org",
    "time": "Tue Nov 26 17:16:17 2019 +0100"
  },
  "message": "export.h: reduce __ksymtab_strings string duplication by using \"MS\" section flags\n\nCommit c3a6cf19e695 (\"export: avoid code duplication in\ninclude/linux/export.h\") refactors export.h quite nicely, but introduces\na slight increase in memory usage due to using the empty string \"\"\ninstead of NULL to indicate that an exported symbol has no namespace. As\nmentioned in that commit, this meant an increase of 1 byte per exported\nsymbol without a namespace. For example, if a kernel configuration has\nabout 10k exported symbols, this would mean that the size of\n__ksymtab_strings would increase by roughly 10kB.\n\nWe can alleviate this situation by utilizing the SHF_MERGE and\nSHF_STRING section flags. SHF_MERGE|SHF_STRING indicate to the linker\nthat the data in the section are null-terminated strings that can be\nmerged to eliminate duplication. More specifically, from the binutils\ndocumentation - \"for sections with both M and S, a string which is a\nsuffix of a larger string is considered a duplicate. Thus \"def\" will be\nmerged with \"abcdef\"; A reference to the first \"def\" will be changed to\na reference to \"abcdef\"+3\". Thus, all the empty strings would be merged\nas well as any strings that can be merged according to the cited method\nabove. For example, \"memset\" and \"__memset\" would be merged to just\n\"__memset\" in __ksymtab_strings.\n\nAs of v5.4-rc5, the following statistics were gathered with x86\ndefconfig with approximately 10.7k exported symbols.\n\nSize of __ksymtab_strings in vmlinux:\n-------------------------------------\nv5.4-rc5: 213834 bytes\nv5.4-rc5 with commit c3a6cf19e695: 224455 bytes\nv5.4-rc5 with this patch: 205759 bytes\n\nSo, we already see memory savings of ~8kB compared to vanilla -rc5 and\nsavings of nearly 18.7kB compared to -rc5 with commit c3a6cf19e695 on top.\n\nUnfortunately, as of this writing, strings will not get deduplicated for\nkernel modules, as ld does not do the deduplication for\nSHF_MERGE|SHF_STRINGS sections for relocatable files (ld -r), which\nkernel modules are. A patch for ld is currently being worked on to\nhopefully allow for string deduplication in relocatable files in the\nfuture.\n\nSuggested-by: Rasmus Villemoes \u003clinux@rasmusvillemoes.dk\u003e\nSigned-off-by: Jessica Yu \u003cjeyu@kernel.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "fa577978fbbde494a7d9ea334b6f05d85827534e",
      "old_mode": 33188,
      "old_path": "include/asm-generic/export.h",
      "new_id": "23bc98e97a66fdb68056a3464240c821a98d7a62",
      "new_mode": 33188,
      "new_path": "include/asm-generic/export.h"
    },
    {
      "type": "modify",
      "old_id": "20126279336908af49eed2e02fbc80af54639315",
      "old_mode": 33188,
      "old_path": "include/linux/export.h",
      "new_id": "c13f7a263d1e4e6633bcd05544787e961340cc54",
      "new_mode": 33188,
      "new_path": "include/linux/export.h"
    }
  ]
}
