{"id":259944,"date":"2022-12-29T09:00:57","date_gmt":"2022-12-29T01:00:57","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=259944"},"modified":"2022-12-23T20:42:49","modified_gmt":"2022-12-23T12:42:49","slug":"linux-hix-715","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-hix-715.html","title":{"rendered":"\u534e\u4e3a\u5f00\u53d1\u8005\u5c06Linux\u6838\u5fc3\u5185\u6838\u51fd\u6570\u901f\u5ea6\u63d0\u5347715\u500d"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n Linux 6.2 \u8fd1\u65e5\u5408\u5e76\u4e86\u4e00\u4e2a\u91cd\u8981\u8865\u4e01\uff0c\u8be5\u8865\u4e01\u80fd\u591f\u5c06\u4e00\u4e2a\u6838\u5fc3\u5185\u6838\u51fd\u6570\u901f\u5ea6\u63d0\u5347 715 \u500d\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u534e\u4e3a\u5f00\u53d1\u8005\u8d21\u732e Linux \u5185\u6838\u8865\u4e01\uff0c\u5c06\u6838\u5fc3\u5185\u6838\u51fd\u6570\u901f\u5ea6\u63d0\u5347 715 \u500d<\/p>\n

\"\"<\/a>
\n\u4ece\u5408\u5e76\u7684\u6ce8\u91ca\u53ef\u77e5\uff0c\u8d21\u732e\u6b64\u8865\u4e01\u7684\u7ef4\u62a4\u8005 Zhen Lei \u6765\u81ea\u534e\u4e3a\uff0c\u4ed6\u5c06 kallsyms_lookup_name () \u7684\u5e73\u5747\u67e5\u627e\u6027\u80fd\u63d0\u9ad8\u4e86 715 \u500d\uff0c\u4ece\u800c\u4f7f\u5185\u6838\u91cc\u9762\u65e7\u5b9e\u73b0\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4ece O (n) \u5347\u7ea7\u5230 O (log (n))\uff0c\u5927\u5e45\u51cf\u5c11\u67e5\u627e\u65f6\u95f4\uff0c\u540c\u65f6\u8fd8\u4fdd\u7559\u4e86 \/proc\/kallsyms \u4e0a\u65e7\u7684\u5b9e\u73b0\u652f\u6301\u3002<\/p>\n

kallsyms_lookup_name () \u51fd\u6570\u7528\u4e8e\u6839\u636e\u540d\u79f0\u67e5\u627e\u7b26\u53f7\u7684\u5730\u5740\uff0c\u5e76\u53ef\u7528\u4e8e\u67e5\u627e\u5185\u6838\u7b26\u53f7\u8868\u4e2d\u7684\u4efb\u4f55\u7b26\u53f7\u3002<\/p>\n

\"\"<\/a><\/p>\n

Zhen Lei \u66fe\u5728\u8f83\u65e9\u7684\u8865\u4e01\u4e2d\u63cf\u8ff0\u4e86 kallsyms_lookup_name () \u7684\u4f18\u5316\u601d\u8def\uff1a\u76ee\u524d\uff0c\u8981\u641c\u7d22\u4e00\u4e2a\u7b26\u53f7\uff0c\u6211\u4eec\u9700\u8981\u5c06 'kallsyms_names' \u4e2d\u7684\u7b26\u53f7\u4e00\u4e2a\u4e00\u4e2a\u5c55\u5f00\uff0c\u7136\u540e\u4f7f\u7528\u5c55\u5f00\u540e\u7684\u5b57\u7b26\u4e32\u8fdb\u884c\u6bd4\u8f83\u3002\u8fd9\u79cd\u7b97\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u662f O (n)\u3002<\/p>\n

\u5982\u679c\u6211\u4eec\u50cf\u5730\u5740\u4e00\u6837\u6309\u5347\u5e8f\u5bf9\u540d\u79f0\u8fdb\u884c\u6392\u5e8f\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u4e8c\u5206\u67e5\u627e\u3002\u8fd9\u79cd\u7b97\u6cd5\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u662f O (log (n))\u3002\u4e3a\u4e86\u4e0d\u6539\u53d8 \u201c\/proc\/kallsyms\u201d \u7684\u5b9e\u73b0\uff0c\u8868 kallsyms_names [] \u4ecd\u7136\u6309\u7167\u5347\u5e8f\u4e0e\u5730\u5740\u4e00\u4e00\u5bf9\u5e94\u5b58\u50a8\u3002\u6dfb\u52a0\u6570\u7ec4 kallsyms_seqs_of_names []\uff0c\u4ee5\u6392\u5e8f\u540e\u7684 names \u5e8f\u53f7\u4e3a\u7d22\u5f15\uff0c\u5bf9\u5e94\u7684\u5185\u5bb9\u4e3a\u6392\u5e8f\u540e\u7684\u5730\u5740\u5e8f\u53f7\u3002\u4f8b\u5982\uff1a\u5047\u8bbe NameX \u5728\u6570\u7ec4 kallsyms_seqs_of_names [] \u4e2d\u7684\u7d22\u5f15\u4e3a 'i'\uff0ckallsyms_seqs_of_names [i] \u7684\u5185\u5bb9\u4e3a 'k'\uff0c\u5219 NameX \u5bf9\u5e94\u7684\u5730\u5740\u4e3a kallsyms_addresses [k]\u3002kallsyms_names [] \u4e2d\u7684\u504f\u79fb\u91cf\u662f get_symbol_offset (k)\u3002<\/p>\n

\u8bf7\u6ce8\u610f\uff0c\u4f7f\u7528\u6b64\u65b9\u6cd5\u5185\u5b58\u4f7f\u7528\u91cf\u5c06\u589e\u52a0 (4 * kallsyms_num_syms) \u5b57\u8282\uff0c\u63a5\u4e0b\u6765\u7684\u4e24\u4e2a\u8865\u4e01\u5c06\u51cf\u5c11 (1 * kallsyms_num_syms) \u5b57\u8282\u5e76\u6b63\u786e\u5904\u7406 CONFIG_LTO_CLANG=y \u7684\u60c5\u51b5\u3002<\/p>\n

\u6027\u80fd\u6d4b\u8bd5\u7ed3\u679c\uff1a(x86)\r\nBefore:\r\nmin=234, max=10364402, avg=5206926\r\nmin=267, max=11168517, avg=5207587\r\nAfter:\r\nmin=1016, max=90894, avg=7272\r\nmin=1014, max=93470, avg=7293\r\n<\/pre>\n

kallsyms_lookup_name () \u7684\u5e73\u5747\u67e5\u627e\u6027\u80fd\u63d0\u9ad8\u4e86 715 \u500d\u3002\u56e0\u6b64\uff0c\u8be5\u8865\u4e01\u5e26\u6765\u7684\u552f\u4e00\u7f3a\u70b9\u662f\u5c06\u5185\u5b58\u5360\u7528\u91cf\u589e\u52a0 3 * kallsyms_num_syms\u3002Linux 6.2 \u7684\u6a21\u5757\u4ee3\u7801\u8fd8\u5305\u542b\u4e00\u4e2a\u5c0f\u7684\u542f\u52a8\u4f18\u5316\uff0c\u5c06\u542f\u52a8\u65f6\u95f4\u7f29\u77ed\u4e86\u5927\u7ea6 30 \u6beb\u79d2\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u534e\u4e3a\u5f00\u53d1\u8005\u8d21\u732e Linux \u5185\u6838\u8865\u4e01\uff0c\u5c06\u6838\u5fc3\u5185\u6838\u51fd\u6570\u901f\u5ea6\u63d0\u5347 715 \u500d \u4ece\u5408\u5e76\u7684\u6ce8\u91ca\u53ef\u77e5\uff0c\u8d21\u732e\u6b64\u8865\u4e01\u7684\u7ef4\u62a4\u8005 […]<\/p>\n","protected":false},"author":643,"featured_media":259966,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[21],"tags":[],"class_list":["post-259944","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/259944","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/643"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=259944"}],"version-history":[{"count":7,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/259944\/revisions"}],"predecessor-version":[{"id":260122,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/259944\/revisions\/260122"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/259966"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=259944"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=259944"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=259944"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}