{"id":2773,"date":"2011-02-17T22:44:28","date_gmt":"2011-02-17T14:44:28","guid":{"rendered":"http:\/\/www.orczhou.com\/?p=2773"},"modified":"2011-04-01T09:52:07","modified_gmt":"2011-04-01T01:52:07","slug":"linux-memory-management-1","status":"publish","type":"post","link":"https:\/\/www.orczhou.com\/index.php\/2011\/02\/linux-memory-management-1\/","title":{"rendered":"Linux\u5185\u5b58\u7ba1\u7406\u5b66\u4e60\u7b14\u8bb0&#8211;\u6982\u8ff0"},"content":{"rendered":"<p>\u968f\u7740\u8981\u7ef4\u62a4\u7684\u670d\u52a1\u5668\u589e\u591a\uff0c\u9047\u5230\u7684\u5404\u79cd\u7a00\u5947\u53e4\u602a\u7684\u95ee\u9898\u4e5f\u4f1a\u589e\u591a\uff0c\u8981\u60f3\u5f7b\u5e95\u89e3\u51b3\u8fd9\u4e9b\u201c\u5c0f\u201d\u95ee\u9898\u5f80\u5f80\u9700\u8981\u66f4\u6df1\u7684Linux\u65b9\u9762\u7684\u77e5\u8bc6\u3002\u8d8a\u4e13\u4e1a\u3001\u5206\u5de5\u8d8a\u7ec6\u7684\u5de5\u7a0b\u5e08\uff0c\u5728\u8fd9\u65b9\u9762\u7684\u8981\u6c42\u4e5f\u5c31\u8d8a\u9ad8\u3002\u8fd9\u6b21\uff0c\u5bf9MySQL Swap\u7684\u95ee\u9898\u7684\u63a2\u7d22\u8fc7\u7a0b\uff0c\u5c31\u4e00\u4e0d\u5c0f\u5fc3\u6389\u8fdb\u4e86Linux Memory Managemant\uff08Linux MM\uff09\u7684\u7814\u7a76\u4e2d\u53bb\u4e86\uff0c\u722c\u4e86\u5f88\u4e45\u624d\u51fa\u6765\uff0c\u8fd9\u91cc\u505a\u4e00\u4e2a\u7cfb\u5217\u7b14\u8bb0\u3002<\/p>\n<p>\u7b14\u8bb0\u4e2d\u5f88\u591a\u5185\u5bb9\u90fd\u662f\u53c2\u8003\u300a<a href=\"http:\/\/www.amazon.com\/Understanding-Linux-Kernel-Third-Daniel\/dp\/0596005652\/ref=sr_1_1?ie=UTF8&#038;qid=1297494046&#038;sr=8-1\">Understanding the Linux Kernel, 3rd Edition<\/a>\u300b\u3001Linux Source Code\u7b49\u5730\u65b9\uff0c\u81ea\u5df1\u518d\u505a\u4e86\u4e00\u4e9b\u603b\u7ed3\uff0c\u89c9\u5f97\u6709\u610f\u4e49\u7684\u603b\u7ed3\u8fd9\u91cc\u8bb0\u5f55\u4e00\u4e0b\uff0c\u4f9b\u53c2\u8003\u3002<\/p>\n<div class=\"myt1\">1. \u5199\u5728\u524d\u9762<\/div>\n<p>Linux MM\u662f\u4e00\u4e2a\u6bd4\u8f83\u7325\u7410\u7684\u4f53\u7cfb\uff0c\u867d\u7136\u7406\u8bba\u4e0d\u592a\u591a\uff0c\u4f46\u662f\u7ec6\u8282\u975e\u5e38\u591a\u3002\u8981\u4ece\u5e95\u5c42\u7269\u7406\u5185\u5b58\u7ba1\u7406\u5230\u4e0a\u5c42\u865a\u62df\u5185\u5b58\u7ba1\u7406\u6574\u4e2a\u5173\u8282\u6253\u901a\uff0c\u4e00\u65b9\u9762\u9700\u8981\u8f83\u591a\u5e95\u5c42\u67b6\u6784\u77e5\u8bc6\u3001\u8fd8\u9700\u8981\u5f88\u6df1\u7684Linux\u77e5\u8bc6\u3002\u65e2\u7136\u662f\u5b66\u4e60\u7b14\u8bb0\uff0c\u5148\u8bf4\u4e00\u4e0b\u6211\u7684\u5b66\u4e60\u8d44\u6599\uff1a<\/p>\n<p>1. <a href=\"http:\/\/tldp.org\/LDP\/tlk\/mm\/memory.html\">Linux Memory Management<\/a> David A Rusling \u8fd9\u672c\u4e66\u5f88\u8001\u4e86\uff0c\u5f53\u65f6\u7684Kernel\u8fd8\u662f2.0.33\u7248\u672c\u7684\uff1b\u8fd9\u672c\u4e66\u7684\u4f18\u70b9\u5728\u4e8e\u62bd\u8c61\u5f97\u5f88\u5230\u4f4d\uff0c\u628aLinux_MM\u7684\u57fa\u672c\u6a21\u5757\u3001\u601d\u60f3\u90fd\u901a\u4fd7\u6613\u61c2\u7684\u4ecb\u7ecd\u4e86\u4e00\u904d\u3002\u8fd9\u4e5f\u662fkernel-docs.txt\u4e2d\u63a8\u8350\u7684\u8bfb\u7269\u4e4b\u4e00\uff1b<\/p>\n<p>2. \u300a<a href=\"http:\/\/www.amazon.com\/Understanding-Linux-Kernel-Third-Daniel\/dp\/0596005652\/ref=sr_1_1?ie=UTF8&#038;qid=1297494046&#038;sr=8-1\">Understanding the Linux Kernel, 3rd Edition<\/a>\u300b\u4e2d\u7684\u7b2c\u4e8c\u3001\u516b\u3001\u5341\u4e03\u7ae0  \u8fd9\u662f\u57fa\u4e8e2.6\u5185\u6838\uff0c\u975e\u5e38\u6709\u53c2\u8003\u4ef7\u503c\uff0c\u4ecb\u7ecd\u5f97\u975e\u5e38\u7ec6\u81f4\uff0c\u53ef\u4ee5\u7ed3\u5408\u5185\u6838\u7684\u6e90\u4ee3\u7801\u4e00\u8d77\u6765\u770b\u3002<\/p>\n<p>3. Linux Source Code  \u53ea\u770b\u4e86\u51e0\u4e2a\u81ea\u5df1\u5173\u5fc3\u7684\u51fd\u6570\uff0c\u6ca1\u90a3\u4e48\u96be:)<\/p>\n<p>\u6211\u4e0d\u662f\u8ba1\u7b97\u673a\u79d1\u73ed\u51fa\u8eab\uff0c\u4f53\u7cfb\u7ed3\u6784\u7684\u57fa\u7840\u6bd4\u8f83\u5dee\uff0c\u6240\u4ee5\u521a\u5f00\u59cb\u5165\u95e8\u7684\u65f6\u95f4\u76f8\u5bf9\u8f83\u957f\uff0c\u524d\u540e\u5927\u6982\u5386\u65f6\u4e00\u4e2a\u6708\uff0c\u5b9e\u9645\u4f0f\u6848\u65f6\u95f4\u7ea650\u5c0f\u65f6\uff0c\u800c\u8fd9\u4e5f\u53ea\u662f\u4e00\u4e2a\u5f00\u59cb<\/p>\n<div class=\"myt1\">2. \u57fa\u672c\u6846\u67b6<\/div>\n<p><img decoding=\"async\" src=\"http:\/\/www.orczhou.com\/wp-content\/uploads\/2011\/02\/Linux-MM-1.jpg\" alt=\"\" title=\"Linux-MM-1\" width=\"580\"  class=\"alignleft size-full wp-image-2777\" \/><\/p>\n<p>\u4e0a\u9762\u662f\u4e00\u5e45\u7b80\u56fe\uff0c\u540e\u9762\u4f1a\u5206\u522b\u4ecb\u7ecd\uff0cKernel\u5982\u4f55\u4f7f\u7528\u5185\u5b58\u3001Kernel\u5982\u4f55\u7ba1\u7406\u5206\u914d\u5185\u5b58\u3001\u7528\u6237\u7a7a\u95f4\u7684\u5185\u5b58\u7ba1\u7406\u3002\u5bf9\u4e8e\u5176\u4e2d\u7684\u4e00\u4e9b\u7ec6\u8282\u5219\u4f1a\u5355\u72ec\u4ecb\u7ecd\uff0c\u4f8b\u5982\u5927\u9875\u5185\u5b58\uff0c\u5185\u5b58\u56de\u6536\u7b97\u7b49\u7b49\u3002<\/p>\n<div class=\"myt1\">2. Linux\u542f\u52a8\u4e0e\u5185\u5b58\u7ba1\u7406<\/div>\n<p>\u5f00\u673a\u7684\u7b2c\u4e00\u4e2a\u8fc7\u7a0b\u662fBIOS\u81ea\u68c0\uff0cBIOS\u4f7f\u75280x00000000\u52300x10000\uff081MB\uff09\u5185\u5b58\uff0c\u8fd91MB\u5185\u5b58\u5305\u62ec\u4e86\u81ea\u68c0\u7a0b\u5e8f\u3001\u81ea\u68c0\u7ed3\u679c\u3001\u8fd8\u7559\u4e00\u90e8\u5206\u7ed9\u663e\u793a\u8bbe\u5907\u4f7f\u7528\uff1b\u81ea\u68c0\u5b8c\u6210\u540e\uff0c\u5f00\u59cb\u8f7d\u5165Linux\u5185\u6838\uff0cLinux\u4ece1MB\u5f00\u59cb\u4f7f\u7528\u7269\u7406\u5185\u5b58\uff0c\u4e00\u822c5MB\u5c31\u8db3\u591f\u4e86\uff0c\u5728\u5185\u6838\u7684\u7b26\u53f7\u4fe1\u606f\u4e2d\u53ef\u4ee5\u770b\u5230\uff0cLinux\u5185\u6838\u4ece_text\u5f00\u59cb\uff0c_edata\u5904\u7ed3\u675f<\/p>\n<div class=\"mycode\">$more \/boot\/System.map-2.6.9-55.ELsmp|grep &#8220;\\ _text$\\|_etext$\\| _edata$\\| _end$&#8221;<br \/>\nffffffff80100000 A _text<br \/>\nffffffff80310399 A _etext<br \/>\nffffffff80456aa8 A _edata\n<\/div>\n<p>\u7b80\u56fe\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.orczhou.com\/wp-content\/uploads\/2011\/02\/Linux-mm-2.jpg\" alt=\"\" title=\"Linux-mm-2\" width=\"475\" height=\"392\" class=\"alignleft size-full wp-image-2782\" srcset=\"https:\/\/www.orczhou.com\/wp-content\/uploads\/2011\/02\/Linux-mm-2.jpg 475w, https:\/\/www.orczhou.com\/wp-content\/uploads\/2011\/02\/Linux-mm-2-300x247.jpg 300w\" sizes=\"auto, (max-width: 475px) 100vw, 475px\" \/><\/p>\n<p>\u8fd9\u91cc\u4e0d\u6d89\u53cax86\u67b6\u6784\u4e0b\u7684\u5206\u9875\u3001\u5206\u6bb5\u7ec6\u8282\uff0c\u540e\u9762\u4f1a\u5355\u72ec\u4ecb\u7ecd\u4e4b\u3002<\/p>\n<p>\u8fd9\u4e00\u7bc7\u5f88\u7b80\u5355\uff0c\u662f\u4e00\u4e2a\u5f00\u59cb:)<\/p>\n<p>\u3010update 2011-03-29\u3011<\/p>\n<p>\u5728<strong>64\u4f4d\u7cfb\u7edf<\/strong>\u4e2d\uff0cLinux(2.6.18)\u4ece2MB\u5f00\u59cb\u4f7f\u7528\u7269\u7406\u5185\u5b58\u3002(32\u4f4d\u7cfb\u7edf\uff0c\u4ecd\u7136\u662f\u4ece1MB\u5f00\u59cb)<\/p>\n<div class=\"mycode\">file: .\/arch\/x86_64\/defconfig<br \/>\nCONFIG_PHYSICAL_START=0x200000<br \/>\n\/\/This gives the physical address where the kernel is loaded.\n<\/div>\n<p>\u53c2\u8003\u6587\u732e\uff1a<\/p>\n<p>[1]. <a href=\"http:\/\/cateee.net\/lkddb\/web-lkddb\/PHYSICAL_START.html\">http:\/\/cateee.net\/lkddb\/web-lkddb\/PHYSICAL_START.html<\/a><\/p>\n<p>\u5e7f\u544a\u65f6\u95f4\uff1a<a href=\"http:\/\/www.orczhou.com\/index.php\/projects\/we-are-hunting-mysql-hacker\/\">\u5de5\u4f5c\u673a\u4f1a&#8211;MySQL Hacker<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u968f\u7740\u8981\u7ef4\u62a4\u7684\u670d\u52a1\u5668\u589e\u591a\uff0c\u9047\u5230\u7684\u5404\u79cd\u7a00\u5947\u53e4\u602a\u7684\u95ee\u9898\u4e5f\u4f1a\u589e\u591a\uff0c\u8981\u60f3\u5f7b\u5e95\u89e3\u51b3\u8fd9\u4e9b\u201c\u5c0f\u201d\u95ee\u9898\u5f80\u5f80\u9700\u8981\u66f4\u6df1\u7684Linux\u65b9\u9762\u7684\u77e5\u8bc6\u3002\u8d8a\u4e13\u4e1a\u3001\u5206\u5de5\u8d8a\u7ec6\u7684\u5de5\u7a0b\u5e08\uff0c\u5728\u8fd9\u65b9\u9762\u7684\u8981\u6c42\u4e5f\u5c31\u8d8a\u9ad8\u3002\u8fd9\u6b21\uff0c\u5bf9MySQL Swap\u7684\u95ee\u9898\u7684\u63a2\u7d22\u8fc7\u7a0b\uff0c\u5c31\u4e00\u4e0d\u5c0f\u5fc3\u6389\u8fdb\u4e86Linux Memory Managemant\uff08Linux MM\uff09\u7684\u7814\u7a76\u4e2d\u53bb\u4e86\uff0c\u722c\u4e86\u5f88\u4e45\u624d\u51fa\u6765\uff0c\u8fd9\u91cc\u505a\u4e00\u4e2a\u7cfb\u5217\u7b14\u8bb0\u3002 \u7b14\u8bb0\u4e2d\u5f88\u591a\u5185\u5bb9\u90fd\u662f\u53c2\u8003\u300aUnderstanding the Linux Kernel, 3rd Edition\u300b\u3001Linux Source Code\u7b49\u5730\u65b9\uff0c\u81ea\u5df1\u518d\u505a\u4e86\u4e00\u4e9b\u603b\u7ed3\uff0c\u89c9\u5f97\u6709\u610f\u4e49\u7684\u603b\u7ed3\u8fd9\u91cc\u8bb0\u5f55\u4e00\u4e0b\uff0c\u4f9b\u53c2\u8003\u3002 1. \u5199\u5728\u524d\u9762 Linux MM\u662f\u4e00\u4e2a\u6bd4\u8f83\u7325\u7410\u7684\u4f53\u7cfb\uff0c\u867d\u7136\u7406\u8bba\u4e0d\u592a\u591a\uff0c\u4f46\u662f\u7ec6\u8282\u975e\u5e38\u591a\u3002\u8981\u4ece\u5e95\u5c42\u7269\u7406\u5185\u5b58\u7ba1\u7406\u5230\u4e0a\u5c42\u865a\u62df\u5185\u5b58\u7ba1\u7406\u6574\u4e2a\u5173\u8282\u6253\u901a\uff0c\u4e00\u65b9\u9762\u9700\u8981\u8f83\u591a\u5e95\u5c42\u67b6\u6784\u77e5\u8bc6\u3001\u8fd8\u9700\u8981\u5f88\u6df1\u7684Linux\u77e5\u8bc6\u3002\u65e2\u7136\u662f\u5b66\u4e60\u7b14\u8bb0\uff0c\u5148\u8bf4\u4e00\u4e0b\u6211\u7684\u5b66\u4e60\u8d44\u6599\uff1a 1. Linux Memory Management David A Rusling \u8fd9\u672c\u4e66\u5f88\u8001\u4e86\uff0c\u5f53\u65f6\u7684Kernel\u8fd8\u662f2.0.33\u7248\u672c\u7684\uff1b\u8fd9\u672c\u4e66\u7684\u4f18\u70b9\u5728\u4e8e\u62bd\u8c61\u5f97\u5f88\u5230\u4f4d\uff0c\u628aLinux_MM\u7684\u57fa\u672c\u6a21\u5757\u3001\u601d\u60f3\u90fd\u901a\u4fd7\u6613\u61c2\u7684\u4ecb\u7ecd\u4e86\u4e00\u904d\u3002\u8fd9\u4e5f\u662fkernel-docs.txt\u4e2d\u63a8\u8350\u7684\u8bfb\u7269\u4e4b\u4e00\uff1b 2. \u300aUnderstanding the Linux Kernel, 3rd Edition\u300b\u4e2d\u7684\u7b2c\u4e8c\u3001\u516b\u3001\u5341\u4e03\u7ae0 \u8fd9\u662f\u57fa\u4e8e2.6\u5185\u6838\uff0c\u975e\u5e38\u6709\u53c2\u8003\u4ef7\u503c\uff0c\u4ecb\u7ecd\u5f97\u975e\u5e38\u7ec6\u81f4\uff0c\u53ef\u4ee5\u7ed3\u5408\u5185\u6838\u7684\u6e90\u4ee3\u7801\u4e00\u8d77\u6765\u770b\u3002 3. Linux Source Code \u53ea\u770b\u4e86\u51e0\u4e2a\u81ea\u5df1\u5173\u5fc3\u7684\u51fd\u6570\uff0c\u6ca1\u90a3\u4e48\u96be:) \u6211\u4e0d\u662f\u8ba1\u7b97\u673a\u79d1\u73ed\u51fa\u8eab\uff0c\u4f53\u7cfb\u7ed3\u6784\u7684\u57fa\u7840\u6bd4\u8f83\u5dee\uff0c\u6240\u4ee5\u521a\u5f00\u59cb\u5165\u95e8\u7684\u65f6\u95f4\u76f8\u5bf9\u8f83\u957f\uff0c\u524d\u540e\u5927\u6982\u5386\u65f6\u4e00\u4e2a\u6708\uff0c\u5b9e\u9645\u4f0f\u6848\u65f6\u95f4\u7ea650\u5c0f\u65f6\uff0c\u800c\u8fd9\u4e5f\u53ea\u662f\u4e00\u4e2a\u5f00\u59cb 2. \u57fa\u672c\u6846\u67b6 \u4e0a\u9762\u662f\u4e00\u5e45\u7b80\u56fe\uff0c\u540e\u9762\u4f1a\u5206\u522b\u4ecb\u7ecd\uff0cKernel\u5982\u4f55\u4f7f\u7528\u5185\u5b58\u3001Kernel\u5982\u4f55\u7ba1\u7406\u5206\u914d\u5185\u5b58\u3001\u7528\u6237\u7a7a\u95f4\u7684\u5185\u5b58\u7ba1\u7406\u3002\u5bf9\u4e8e\u5176\u4e2d\u7684\u4e00\u4e9b\u7ec6\u8282\u5219\u4f1a\u5355\u72ec\u4ecb\u7ecd\uff0c\u4f8b\u5982\u5927\u9875\u5185\u5b58\uff0c\u5185\u5b58\u56de\u6536\u7b97\u7b49\u7b49\u3002 2. Linux\u542f\u52a8\u4e0e\u5185\u5b58\u7ba1\u7406 \u5f00\u673a\u7684\u7b2c\u4e00\u4e2a\u8fc7\u7a0b\u662fBIOS\u81ea\u68c0\uff0cBIOS\u4f7f\u75280x00000000\u52300x10000\uff081MB\uff09\u5185\u5b58\uff0c\u8fd91MB\u5185\u5b58\u5305\u62ec\u4e86\u81ea\u68c0\u7a0b\u5e8f\u3001\u81ea\u68c0\u7ed3\u679c\u3001\u8fd8\u7559\u4e00\u90e8\u5206\u7ed9\u663e\u793a\u8bbe\u5907\u4f7f\u7528\uff1b\u81ea\u68c0\u5b8c\u6210\u540e\uff0c\u5f00\u59cb\u8f7d\u5165Linux\u5185\u6838\uff0cLinux\u4ece1MB\u5f00\u59cb\u4f7f\u7528\u7269\u7406\u5185\u5b58\uff0c\u4e00\u822c5MB\u5c31\u8db3\u591f\u4e86\uff0c\u5728\u5185\u6838\u7684\u7b26\u53f7\u4fe1\u606f\u4e2d\u53ef\u4ee5\u770b\u5230\uff0cLinux\u5185\u6838\u4ece_text\u5f00\u59cb\uff0c_edata\u5904\u7ed3\u675f $more \/boot\/System.map-2.6.9-55.ELsmp|grep &#8220;\\ _text$\\|_etext$\\| _edata$\\| _end$&#8221; ffffffff80100000 A _text ffffffff80310399 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","inline_featured_image":false,"_tocer_settings":[],"footnotes":""},"categories":[27],"tags":[],"class_list":["post-2773","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/2773","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/comments?post=2773"}],"version-history":[{"count":21,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/2773\/revisions"}],"predecessor-version":[{"id":2890,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/2773\/revisions\/2890"}],"wp:attachment":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/media?parent=2773"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/categories?post=2773"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/tags?post=2773"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}