GFP_KERNEL or SLAB_KERNEL?
The kernel slab allocator is an additional layer built on top of the low-level code; it handles situations where numerous objects of the same size are frequently allocated and freed. The slab code, too, has a set of flags describing how memory allocation is to happen. They look suspiciously like the low-level flags, but they have different names; instead of GFP_KERNEL, for example, user of the slab code are expected to say SLAB_KERNEL.
Underneath it all, however, the two sets of flags are the same. As a result, many calls to the slab code just use the GFP_ flags, rather than the SLAB_ flags. William Lee Irwin decided it was time to fix that; he posted a patch converting several slab users over to the SLAB_ flags. It looked like a fairly standard, freeze-stage kernel cleanup.
The question came up, however: why bother? Not everybody, it seems, thinks that the separate SLAB_flags are worth the trouble. William responded with another patch which gets rid of the SLAB_flags altogether. So far, neither patch has been merged. But they do raise a worthwhile question: why do we need a separate set of flags if the callers have nothing different to say?
本文详细探讨了内核级内存分配函数所携带的标志,包括GFP_系列和SLAB_系列标志,解释了它们在内存管理过程中的作用,特别是SLAB_系列标志的引入及与GFP_系列的区别。文章还提到了William Lee Irwin提出的问题,即是否有必要保留两个独立的标志集,以及后续的解决策略。
3万+

被折叠的 条评论
为什么被折叠?



