{"id":3937,"date":"2012-04-10T23:21:34","date_gmt":"2012-04-10T15:21:34","guid":{"rendered":"http:\/\/edsionte.com\/techblog\/?p=3937"},"modified":"2012-05-03T17:46:35","modified_gmt":"2012-05-03T09:46:35","slug":"linux%e5%86%85%e5%ad%98%e5%88%86%e9%85%8d%e5%87%bd%e6%95%b0%e7%9a%84%e5%ae%9e%e7%8e%b0","status":"publish","type":"post","link":"http:\/\/edsionte.com\/techblog\/archives\/3937","title":{"rendered":"Linux\u7269\u7406\u5185\u5b58\u7ba1\u7406\u6982\u8ff0"},"content":{"rendered":"<p>\u5728\u5185\u6838\u6001\u7533\u8bf7\u5185\u5b58\u6bd4\u5728\u7528\u6237\u6001\u7533\u8bf7\u5185\u5b58\u8981\u66f4\u4e3a\u76f4\u63a5\uff0c\u5b83\u6ca1\u6709\u91c7\u7528\u7528\u6237\u6001\u90a3\u79cd\u5ef6\u8fdf\u5206\u914d\u5185\u5b58\u6280\u672f\u3002\u5185\u6838\u8ba4\u4e3a\u4e00\u65e6\u6709\u5185\u6838\u51fd\u6570\u7533\u8bf7\u5185\u5b58\uff0c\u90a3\u4e48\u5c31\u5fc5\u987b\u7acb\u523b\u6ee1\u8db3\u8be5\u7533\u8bf7\u5185\u5b58\u7684\u8bf7\u6c42\uff0c\u5e76\u4e14\u8fd9\u4e2a\u8bf7\u6c42\u4e00\u5b9a\u662f\u6b63\u786e\u5408\u7406\u7684\u3002\u76f8\u53cd\uff0c\u5bf9\u4e8e\u7528\u6237\u6001\u7533\u8bf7\u5185\u5b58\u7684\u8bf7\u6c42\uff0c\u5185\u6838\u603b\u662f\u5c3d\u91cf\u5ef6\u540e\u5206\u914d\u7269\u7406\u5185\u5b58\uff0c\u7528\u6237\u8fdb\u7a0b\u603b\u662f\u5148\u83b7\u5f97\u4e00\u4e2a\u865a\u62df\u5185\u5b58\u533a\u7684\u4f7f\u7528\u6743\uff0c\u6700\u7ec8\u901a\u8fc7\u7f3a\u9875\u5f02\u5e38\u83b7\u5f97\u4e00\u5757\u771f\u6b63\u7684\u7269\u7406\u5185\u5b58\u3002<\/p>\n<h3>1.\u7269\u7406\u5185\u5b58\u7684\u5185\u6838\u6620\u5c04<\/h3>\n<p>IA32\u67b6\u6784\u4e2d\u5185\u6838\u865a\u62df\u5730\u5740\u7a7a\u95f4\u53ea\u67091GB\u5927\u5c0f\uff08\u4ece3GB\u52304GB\uff09\uff0c\u56e0\u6b64\u53ef\u4ee5\u76f4\u63a5\u5c061GB\u5927\u5c0f\u7684\u7269\u7406\u5185\u5b58\uff08\u5373\u5e38\u89c4\u5185\u5b58\uff09\u6620\u5c04\u5230\u5185\u6838\u5730\u5740\u7a7a\u95f4\uff0c\u4f46\u8d85\u51fa1GB\u5927\u5c0f\u7684\u7269\u7406\u5185\u5b58\uff08\u5373\u9ad8\u7aef\u5185\u5b58\uff09\u5c31\u4e0d\u80fd\u6620\u5c04\u5230\u5185\u6838\u7a7a\u95f4\u3002\u4e3a\u6b64\uff0c\u5185\u6838\u91c7\u53d6\u4e86\u4e0b\u9762\u7684\u65b9\u6cd5\u4f7f\u5f97\u5185\u6838\u53ef\u4ee5\u4f7f\u7528\u6240\u6709\u7684\u7269\u7406\u5185\u5b58\u3002<\/p>\n<p>1.\u9ad8\u7aef\u5185\u5b58\u4e0d\u80fd\u5168\u90e8\u6620\u5c04\u5230\u5185\u6838\u7a7a\u95f4\uff0c\u4e5f\u5c31\u662f\u8bf4\u8fd9\u4e9b\u7269\u7406\u5185\u5b58\u6ca1\u6709\u5bf9\u5e94\u7684\u7ebf\u6027\u5730\u5740\u3002\u4e0d\u8fc7\uff0c\u5185\u6838\u4e3a\u6bcf\u4e2a\u7269\u7406\u9875\u6846\u90fd\u5206\u914d\u4e86\u5bf9\u5e94\u7684\u9875\u6846\u63cf\u8ff0\u7b26\uff0c\u6240\u6709\u7684\u9875\u6846\u63cf\u8ff0\u7b26\u90fd\u4fdd\u5b58\u5728mem_map\u6570\u7ec4\u4e2d\uff0c\u56e0\u6b64\u6bcf\u4e2a\u9875\u6846\u63cf\u8ff0\u7b26\u7684\u7ebf\u6027\u5730\u5740\u90fd\u662f\u56fa\u5b9a\u5b58\u5728\u7684\u3002\u5185\u6838\u6b64\u65f6\u53ef\u4ee5\u4f7f\u7528alloc_pages()\u548calloc_page()\u6765\u5206\u914d\u9ad8\u7aef\u5185\u5b58\uff0c\u56e0\u4e3a\u8fd9\u4e9b\u51fd\u6570\u8fd4\u56de\u9875\u6846\u63cf\u8ff0\u7b26\u7684\u7ebf\u6027\u5730\u5740\u3002<\/p>\n<p>2.\u5185\u6838\u5730\u5740\u7a7a\u95f4\u7684\u540e128MB\u4e13\u95e8\u7528\u4e8e\u6620\u5c04\u9ad8\u7aef\u5185\u5b58\uff0c\u5426\u5219\uff0c\u6ca1\u6709\u7ebf\u6027\u5730\u5740\u7684\u9ad8\u7aef\u5185\u5b58\u4e0d\u80fd\u88ab\u5185\u6838\u6240\u8bbf\u95ee\u3002\u8fd9\u4e9b\u9ad8\u7aef\u5185\u5b58\u7684\u5185\u6838\u6620\u5c04\u663e\u7136\u662f\u6682\u65f6\u6620\u5c04\u7684\uff0c\u5426\u5219\u4e5f\u53ea\u80fd\u6620\u5c04128MB\u7684\u9ad8\u7aef\u5185\u5b58\u3002\u5f53\u5185\u6838\u9700\u8981\u8bbf\u95ee\u9ad8\u7aef\u5185\u5b58\u65f6\u5c31\u4e34\u65f6\u5728\u8fd9\u4e2a\u533a\u57df\u8fdb\u884c\u5730\u5740\u6620\u5c04\uff0c\u4f7f\u7528\u5b8c\u6bd5\u4e4b\u540e\u518d\u7528\u6765\u8fdb\u884c\u5176\u4ed6\u9ad8\u7aef\u5185\u5b58\u7684\u6620\u5c04\u3002<\/p>\n<p>\u7531\u4e8e\u8981\u8fdb\u884c\u9ad8\u7aef\u5185\u5b58\u7684\u5185\u6838\u6620\u5c04\uff0c\u56e0\u6b64\u76f4\u63a5\u80fd\u591f\u6620\u5c04\u7684\u7269\u7406\u5185\u5b58\u5927\u5c0f\u53ea\u6709896MB\uff0c\u8be5\u503c\u4fdd\u5b58\u5728high_memory\u4e2d\u3002\u5185\u6838\u5730\u5740\u7a7a\u95f4\u7684\u7ebf\u6027\u5730\u5740\u533a\u95f4\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/edsionte.com\/techblog\/archives\/3937\/phy_addr\" rel=\"attachment wp-att-3969\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-3969\" title=\"phy_addr\" src=\"http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2012\/04\/phy_addr.jpeg\" alt=\"\" width=\"410\" height=\"284\" srcset=\"http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2012\/04\/phy_addr.jpeg 683w, http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2012\/04\/phy_addr-300x208.jpg 300w\" sizes=\"auto, (max-width: 410px) 100vw, 410px\" \/><\/a><\/p>\n<p>\u4ece\u56fe\u4e2d\u53ef\u4ee5\u770b\u51fa\uff0c\u5185\u6838\u91c7\u7528\u4e86\u4e09\u79cd\u673a\u5236\u5c06\u9ad8\u7aef\u5185\u5b58\u6620\u5c04\u5230\u5185\u6838\u7a7a\u95f4\uff1a\u6c38\u4e45\u5185\u6838\u6620\u5c04\uff0c\u56fa\u5b9a\u6620\u5c04\u548cvmalloc\u673a\u5236\u3002<\/p>\n<h3>2.\u7269\u7406\u5185\u5b58\u7ba1\u7406\u673a\u5236<\/h3>\n<p>\u57fa\u4e8e\u7269\u7406\u5185\u5b58\u5728\u5185\u6838\u7a7a\u95f4\u4e2d\u7684\u6620\u5c04\u539f\u7406\uff0c\u7269\u7406\u5185\u5b58\u7684\u7ba1\u7406\u65b9\u5f0f\u4e5f\u6709\u6240\u4e0d\u540c\u3002\u5185\u6838\u4e2d\u7269\u7406\u5185\u5b58\u7684\u7ba1\u7406\u673a\u5236\u4e3b\u8981\u6709\u4f19\u4f34\u7b97\u6cd5\uff0cslab\u9ad8\u901f\u7f13\u5b58\u548cvmalloc\u673a\u5236\u3002\u5176\u4e2d\u4f19\u4f34\u7b97\u6cd5\u548cslab\u9ad8\u901f\u7f13\u5b58\u90fd\u5728\u7269\u7406\u5185\u5b58\u6620\u5c04\u533a\u5206\u914d\u7269\u7406\u5185\u5b58\uff0c\u800cvmalloc\u673a\u5236\u5219\u5728\u9ad8\u7aef\u5185\u5b58\u6620\u5c04\u533a\u5206\u914d\u7269\u7406\u5185\u5b58\u3002<\/p>\n<p><strong>\u4f19\u4f34\u7b97\u6cd5<\/strong><\/p>\n<p>\u4f19\u4f34\u7b97\u6cd5\u8d1f\u8d23\u5927\u5757\u8fde\u7eed\u7269\u7406\u5185\u5b58\u7684\u5206\u914d\u548c\u91ca\u653e\uff0c\u4ee5\u9875\u6846\u4e3a\u57fa\u672c\u5355\u4f4d\u3002\u8be5\u673a\u5236\u53ef\u4ee5\u907f\u514d\u5916\u90e8\u788e\u7247\u3002<\/p>\n<p><strong>per-CPU\u9875\u6846\u9ad8\u901f\u7f13\u5b58<\/strong><\/p>\n<p>\u5185\u6838\u7ecf\u5e38\u8bf7\u6c42\u548c\u91ca\u653e\u5355\u4e2a\u9875\u6846\uff0c\u8be5\u7f13\u5b58\u5305\u542b\u9884\u5148\u5206\u914d\u7684\u9875\u6846\uff0c\u7528\u4e8e\u6ee1\u8db3\u672c\u5730CPU\u53d1\u51fa\u7684\u5355\u4e00\u9875\u6846\u8bf7\u6c42\u3002<\/p>\n<p><strong>slab\u7f13\u5b58<\/strong><\/p>\n<p>slab\u7f13\u5b58\u8d1f\u8d23\u5c0f\u5757\u7269\u7406\u5185\u5b58\u7684\u5206\u914d\uff0c\u5e76\u4e14\u5b83\u4e5f\u4f5c\u4e3a\u9ad8\u901f\u7f13\u5b58\uff0c\u4e3b\u8981\u9488\u5bf9\u5185\u6838\u4e2d\u7ecf\u5e38\u5206\u914d\u5e76\u91ca\u653e\u7684\u5bf9\u8c61\u3002<\/p>\n<p><strong>vmalloc\u673a\u5236<\/strong><\/p>\n<p>vmalloc\u673a\u5236\u4f7f\u5f97\u5185\u6838\u901a\u8fc7\u8fde\u7eed\u7684\u7ebf\u6027\u5730\u5740\u6765\u8bbf\u95ee\u975e\u8fde\u7eed\u7684\u7269\u7406\u9875\u6846\uff0c\u8fd9\u6837\u53ef\u4ee5\u6700\u5927\u9650\u5ea6\u7684\u4f7f\u7528\u9ad8\u7aef\u7269\u7406\u5185\u5b58\u3002<\/p>\n<h3>3.\u7269\u7406\u5185\u5b58\u7684\u5206\u914d<\/h3>\n<p>\u5185\u6838\u53d1\u51fa\u5185\u5b58\u7533\u8bf7\u7684\u8bf7\u6c42\u65f6\uff0c\u6839\u636e\u5185\u6838\u51fd\u6570\u8c03\u7528\u63a5\u53e3\u5c06\u542f\u7528\u4e0d\u540c\u7684\u5185\u5b58\u5206\u914d\u5668\u3002<\/p>\n<p><strong>3.1 \u5206\u533a\u9875\u6846\u5206\u914d\u5668<\/strong><\/p>\n<p>\u5206\u533a\u9875\u6846\u5206\u914d\u5668 (zoned page frame allocator) ,\u5904\u7406\u5bf9\u8fde\u7eed\u9875\u6846\u7684\u5185\u5b58\u5206\u914d\u8bf7\u6c42\u3002\u5206\u533a\u9875\u6846\u7ba1\u7406\u5668\u5206\u4e3a\u4e24\u5927\u90e8\u5206:\u524d\u7aef\u7684\u7ba1\u7406\u533a\u5206\u914d\u5668\u548c\u4f19\u4f34\u7cfb\u7edf\uff0c\u5982\u4e0b\u56fe\uff1a<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/edsionte.com\/techblog\/archives\/3937\/page_allocator\" rel=\"attachment wp-att-3953\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-3953\" title=\"page_allocator\" src=\"http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2012\/05\/page_allocator.jpeg\" alt=\"\" width=\"396\" height=\"255\" srcset=\"http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2012\/05\/page_allocator.jpeg 708w, http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2012\/05\/page_allocator-300x193.jpg 300w\" sizes=\"auto, (max-width: 396px) 100vw, 396px\" \/><\/a><\/p>\n<p>\u7ba1\u7406\u533a\u5206\u914d\u5668\u8d1f\u8d23\u641c\u7d22\u4e00\u4e2a\u80fd\u6ee1\u8db3\u8bf7\u6c42\u9875\u6846\u5757\u5927\u5c0f\u7684\u7ba1\u7406\u533a\u3002\u5728\u6bcf\u4e2a\u7ba1\u7406\u533a\u4e2d,\u5177\u4f53\u7684\u9875\u6846\u5206\u914d\u5de5\u4f5c\u7531\u4f19\u4f34\u7cfb\u7edf\u8d1f\u8d23\u3002\u4e3a\u4e86\u8fbe\u5230\u66f4\u597d\u7684\u7cfb\u7edf\u6027\u80fd,\u5355\u4e2a\u9875\u6846\u7684\u7533\u8bf7\u5de5\u4f5c\u76f4\u63a5\u901a\u8fc7per-CPU\u9875\u6846\u9ad8\u901f\u7f13\u5b58\u5b8c\u6210\u3002<\/p>\n<p>\u8be5\u5206\u914d\u5668\u901a\u8fc7\u51e0\u4e2a\u51fd\u6570\u548c\u5b8f\u6765\u8bf7\u6c42\u9875\u6846,\u5b83\u4eec\u4e4b\u95f4\u7684\u5c01\u88c5\u5173\u7cfb\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/edsionte.com\/techblog\/archives\/3937\/memapi-3\" rel=\"attachment wp-att-3966\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-3966\" title=\"memAPI\" src=\"http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2012\/04\/memAPI.jpeg\" alt=\"\" width=\"357\" height=\"345\" srcset=\"http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2012\/04\/memAPI.jpeg 595w, http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2012\/04\/memAPI-300x289.jpg 300w\" sizes=\"auto, (max-width: 357px) 100vw, 357px\" \/><\/a><\/p>\n<p>\u8fd9\u4e9b\u51fd\u6570\u548c\u5b8f\u5c06\u6838\u5fc3\u7684\u5206\u914d\u51fd\u6570__alloc_pages_nodemask()\u5c01\u88c5,\u5f62\u6210\u6ee1\u8db3\u4e0d\u540c\u5206\u914d\u9700\u6c42\u7684\u5206\u914d\u51fd\u6570\u3002\u5176\u4e2d\uff0calloc_pages()\u7cfb\u5217\u51fd\u6570\u8fd4\u56de\u7269\u7406\u5185\u5b58\u9996\u9875\u6846\u63cf\u8ff0\u7b26\uff0c__get_free_pages()\u7cfb\u5217\u51fd\u6570\u8fd4\u56de\u5185\u5b58\u7684\u7ebf\u6027\u5730\u5740\u3002<\/p>\n<p><strong>3.2 slab\u5206\u914d\u5668<\/strong><\/p>\n<p>slab \u5206\u914d\u5668\u6700\u521d\u662f\u4e3a\u4e86\u89e3\u51b3\u7269\u7406\u5185\u5b58\u7684\u5185\u90e8\u788e\u7247\u800c\u63d0\u51fa\u7684\uff0c\u5b83\u5c06\u5185\u6838\u4e2d\u5e38\u7528\u7684\u6570\u636e\u7ed3\u6784\u770b\u505a\u5bf9\u8c61\u3002slab\u5206\u914d\u5668\u4e3a\u6bcf\u4e00\u79cd\u5bf9\u8c61\u5efa\u7acb\u9ad8\u901f\u7f13\u5b58\u3002\u5185\u6838\u5bf9\u8be5\u5bf9\u8c61\u7684\u5206\u914d\u548c\u91ca\u653e\u5747\u662f\u5728\u8fd9\u5757\u9ad8\u901f\u7f13\u5b58\u4e2d\u64cd\u4f5c\u3002\u4e00\u79cd\u5bf9\u8c61\u7684slab\u5206\u914d\u5668\u7ed3\u6784\u56fe\u5982\u4e0b\uff1a<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/edsionte.com\/techblog\/archives\/3937\/slab_cache\" rel=\"attachment wp-att-3970\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-3970\" title=\"slab_cache\" src=\"http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2012\/04\/slab_cache.jpeg\" alt=\"\" width=\"505\" height=\"221\" srcset=\"http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2012\/04\/slab_cache.jpeg 841w, http:\/\/edsionte.com\/techblog\/wordpress\/wp-content\/uploads\/2012\/04\/slab_cache-300x131.jpg 300w\" sizes=\"auto, (max-width: 505px) 100vw, 505px\" \/><\/a><\/p>\n<p>\u53ef\u4ee5\u770b\u5230\u6bcf\u79cd\u5bf9\u8c61\u7684\u9ad8\u901f\u7f13\u5b58\u662f\u7531\u82e5\u5e72\u4e2aslab\u7ec4\u6210\uff0c\u6bcf\u4e2aslab\u662f\u7531\u82e5\u5e72\u4e2a\u9875\u6846\u7ec4\u6210\u7684\u3002\u867d\u7136slab\u5206\u914d\u5668\u53ef\u4ee5\u5206\u914d\u6bd4\u5355\u4e2a\u9875\u6846\u66f4\u5c0f\u7684\u5185\u5b58\u5757\uff0c\u4f46\u5b83\u6240\u9700\u7684\u6240\u6709\u5185\u5b58\u90fd\u662f\u901a\u8fc7\u4f19\u4f34\u7b97\u6cd5\u5206\u914d\u7684\u3002<\/p>\n<p>slab\u9ad8\u901f\u7f13\u5b58\u5206\u4e13\u7528\u7f13\u5b58\u548c\u901a\u7528\u7f13\u5b58\u3002\u4e13\u7528\u7f13\u5b58\u662f\u5bf9\u7279\u5b9a\u7684\u5bf9\u8c61\uff0c\u6bd4\u5982\u4e3a\u5185\u5b58\u63cf\u8ff0\u7b26\u521b\u5efa\u9ad8\u901f\u7f13\u5b58\u3002\u901a\u7528\u7f13\u5b58\u5219\u662f\u9488\u5bf9\u4e00\u822c\u60c5\u51b5\uff0c\u9002\u5408\u5206\u914d\u4efb\u610f\u5927\u5c0f\u7684\u7269\u7406\u5185\u5b58\uff0c\u5176\u63a5\u53e3\u5373\u4e3akmalloc()\u3002<\/p>\n<p><strong>3.3 \u975e\u8fde\u7eed\u5185\u5b58\u533a\u5185\u5b58\u7684\u5206\u914d<\/strong><\/p>\n<p>\u5185\u6838\u901a\u8fc7vmalloc()\u6765\u7533\u8bf7\u975e\u8fde\u7eed\u7684\u7269\u7406\u5185\u5b58\uff0c\u82e5\u7533\u8bf7\u6210\u529f\uff0c\u8be5\u51fd\u6570\u8fd4\u56de\u8fde\u7eed\u5185\u5b58\u533a\u7684\u8d77\u59cb\u5730\u5740\uff0c\u5426\u5219\uff0c\u8fd4\u56deNULL\u3002vmalloc()\u548ckmalloc()\u7533\u8bf7\u7684\u5185\u5b58\u6709\u6240\u4e0d\u540c\uff0ckmalloc()\u6240\u7533\u8bf7\u5185\u5b58\u7684\u7ebf\u6027\u5730\u5740\u4e0e\u7269\u7406\u5730\u5740\u90fd\u662f\u8fde\u7eed\u7684\uff0c\u800cvmalloc()\u6240\u7533\u8bf7\u7684\u5185\u5b58\u7ebf\u6027\u5730\u5740\u8fde\u7eed\u800c\u7269\u7406\u5730\u5740\u5219\u662f\u79bb\u6563\u7684\uff0c\u4e24\u4e2a\u5730\u5740\u4e4b\u95f4\u901a\u8fc7\u5185\u6838\u9875\u8868\u8fdb\u884c\u6620\u5c04\u3002<\/p>\n<p>vmalloc()\u7684\u5de5\u4f5c\u65b9\u5f0f\u7406\u89e3\u8d77\u6765\u5f88\u7b80\u5355\uff1a<\/p>\n<p>1.\u5bfb\u627e\u4e00\u4e2a\u65b0\u7684\u8fde\u7eed\u7ebf\u6027\u5730\u5740\u7a7a\u95f4\uff1b<\/p>\n<p>2.\u4f9d\u6b21\u5206\u914d\u4e00\u7ec4\u975e\u8fde\u7eed\u7684\u9875\u6846\uff1b<\/p>\n<p>3.\u4e3a\u7ebf\u6027\u5730\u5740\u7a7a\u95f4\u548c\u975e\u8fde\u7eed\u9875\u6846\u5efa\u7acb\u6620\u5c04\u5173\u7cfb\uff0c\u5373\u4fee\u6539\u5185\u6838\u9875\u8868\uff1b<\/p>\n<p>vmalloc()\u7684\u5185\u5b58\u5206\u914d\u539f\u7406\u4e0e\u7528\u6237\u6001\u7684\u5185\u5b58\u5206\u914d\u76f8\u4f3c\uff0c\u90fd\u662f\u901a\u8fc7\u8fde\u7eed\u7684\u865a\u62df\u5185\u5b58\u6765\u8bbf\u95ee\u79bb\u6563\u7684\u7269\u7406\u5185\u5b58\uff0c\u5e76\u4e14\u865a\u62df\u5730\u5740\u548c\u7269\u7406\u5730\u5740\u4e4b\u95f4\u662f\u901a\u8fc7\u9875\u8868\u8fdb\u884c\u8fde\u63a5\u7684\uff0c\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u6709\u6548\u7684\u4f7f\u7528\u7269\u7406\u5185\u5b58\u3002\u4f46\u662f\u5e94\u8be5\u6ce8\u610f\u7684\u662f\uff0cvmalloc()\u7533\u8bf7\u7269\u7406\u5185\u5b58\u65f6\u662f\u7acb\u5373\u5206\u914d\u7684\uff0c\u56e0\u4e3a\u5185\u6838\u8ba4\u4e3a\u8fd9\u79cd\u5185\u5b58\u5206\u914d\u8bf7\u6c42\u662f\u6b63\u5f53\u800c\u4e14\u7d27\u6025\u7684\uff1b\u76f8\u53cd\uff0c\u7528\u6237\u6001\u6709\u5185\u5b58\u8bf7\u6c42\u65f6\uff0c\u5185\u6838\u603b\u662f\u5c3d\u53ef\u80fd\u7684\u5ef6\u540e\uff0c\u6bd5\u7adf\u7528\u6237\u6001\u8ddf\u5185\u6838\u6001\u4e0d\u5728\u4e00\u4e2a\u7279\u6743\u7ea7\u3002<\/p>\n<p><strong>\u540e\u8bb0\uff1a\u672c\u6587\u5c06Linux\u5185\u6838\u4e2d\u7269\u7406\u5185\u5b58\u7ba1\u7406\u8fd9\u90e8\u5206\u5185\u5bb9\u8fdb\u884c\u6846\u67b6\u6027\u603b\u7ed3\uff0c\u5bf9\u5185\u5b58\u7ba1\u7406\u611f\u5174\u8da3\u7684\u540c\u5b66\u53ef\u4ee5\u4ece\u4f19\u4f34\u7b97\u6cd5\uff0cslab\u548cvmalloc()\u4e09\u4e2a\u89d2\u5ea6\u53bb\u4e86\u89e3\u548c\u5b66\u4e60\u7269\u7406\u5185\u5b58\u7ba1\u7406\u3002<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u5185\u6838\u6001\u7533\u8bf7\u5185\u5b58\u6bd4\u5728\u7528\u6237\u6001\u7533\u8bf7\u5185\u5b58\u8981\u66f4\u4e3a\u76f4\u63a5\uff0c\u5b83\u6ca1\u6709\u91c7\u7528\u7528\u6237\u6001\u90a3\u79cd\u5ef6\u8fdf\u5206\u914d\u5185\u5b58\u6280\u672f\u3002\u5185\u6838\u8ba4\u4e3a\u4e00\u65e6\u6709\u5185\u6838\u51fd\u6570\u7533\u8bf7 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[266],"tags":[334,333,314,330,304],"class_list":["post-3937","post","type-post","status-publish","format-standard","hentry","category-266","tag-per-cpu","tag-slab","tag-314","tag-330","tag-304"],"views":16995,"_links":{"self":[{"href":"http:\/\/edsionte.com\/techblog\/wp-json\/wp\/v2\/posts\/3937","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/edsionte.com\/techblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/edsionte.com\/techblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/edsionte.com\/techblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/edsionte.com\/techblog\/wp-json\/wp\/v2\/comments?post=3937"}],"version-history":[{"count":0,"href":"http:\/\/edsionte.com\/techblog\/wp-json\/wp\/v2\/posts\/3937\/revisions"}],"wp:attachment":[{"href":"http:\/\/edsionte.com\/techblog\/wp-json\/wp\/v2\/media?parent=3937"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/edsionte.com\/techblog\/wp-json\/wp\/v2\/categories?post=3937"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/edsionte.com\/techblog\/wp-json\/wp\/v2\/tags?post=3937"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}