In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to apply for chunks of memory in the Linux kernel environment". The content is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to apply for chunks of memory in the Linux kernel environment".
In the Linux kernel environment, the success rate of applying for large chunks of memory decreases with the increase of system running time. Although it is possible to request physically discontiguous memory with continuous virtual addresses through vmalloc series calls, it is inefficient and the memory address space of vmalloc on 32-bit systems is limited. Therefore, the general recommendation is to apply for large chunks of memory during the system startup phase, but the probability of success is only high, not 100%. If the program really cares about the success of the application, it can only deactivate the "boot memory" (Boot Memory). The following is a sample code to apply for and export startup memory:
Void* x_bootmem = NULL;EXPORT_SYMBOL (x_bootmem); unsigned long x_bootmem_size = 0political exportable Sybiol (x_bootmem_size); static int _ init x_bootmem_setup (char * str) {x_bootmem_size = memparse (str, & str); x_bootmem = alloc_bootmem (x_bootmem_size); printk ("Reserved% lu bytes from% p for x\ n", x_bootmem_size, x_bootmem); return 1 } _ _ setup ("xmurbootmem=", x_bootmem_setup)
It can be seen that its application is relatively simple, but the advantages and disadvantages are always symbiotic, and it inevitably has its own limitations:
1. The memory request code can only be connected to the kernel and cannot be used in the module.
two。 The requested memory will not be used and counted by the page allocator and slab allocator, which means that it is outside the system's visible memory, even if you release it somewhere in the future.
3. The average user will only apply for a large block of memory, and if you need to implement complex memory management on it, you need to implement it yourself.
In situations where memory allocation failure is not allowed, booting memory space will be our only choice.
These are all the contents of the article "how to apply for large chunks of memory in the Linux kernel environment". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.