Slab allocator – a few additional details
A few more key points remain to be explored. First, we’ll divulge some information on using the kernel’s resource-managed versions of the memory allocator APIs, followed by a few additionally available slab helper routines within the kernel, and then have a brief look at cgroups and memory. We recommend you go through these sections as well. Please, do read on!
Using the kernel’s resource-managed memory allocation APIs
Especially useful when working on device drivers, the kernel provides a few managed APIs for memory allocation. These are formally referred to as the device resource-managed or devres APIs (the link to the official kernel documentation on this is https://www.kernel.org/doc/html/latest/driver-api/driver-model/devres.html). All these APIs are prefixed with devm_
; though there are several of them, we will focus on only one common use case here – that of using the resource-managed versions...