Thus far, we have used kmalloc and kfree for the allocation and freeing of memory. The Linux kernel offers a richer set of memory allocation primitives, however. In this chapter, we look at other ways of using memory in device drivers and how to opti-mize your system's memory resources. We do not get into how the different architec-tures actually administer memory. Modules are not involved in issues of segmentation, paging, and so on, since the kernel offers a unified memory manage-ment interface to the drivers. In addition, we won't describe the internal details of memory management in this chapter, but defer it to Chapter 15. The Real Story of kmalloc The kmalloc allocation engine is a powerful tool and easily learned because of its similarity to malloc. The function is fast (unless it blocks) and doesn't clear the mem-ory it obtains; the allocated region still holds its previous content. * The allocated region is also contiguous in physical memory. In the next few sections, we talk in detail about kmalloc, so you can compare it with the memory allocation techniques that we discuss later.
CITATION STYLE
Milanesi, C. (2018). Allocating Memory. In Beginning Rust (pp. 135–154). Apress. https://doi.org/10.1007/978-1-4842-3468-6_11
Mendeley helps you to discover research relevant for your work.