slab/slub/slob: Linux kernel memory mngmt

In linux mm folder, there are 3 files that about kmalloc/kmem, slab/slub/slob, where slab.c defines general memory usage, slub.c defines modern memory usage, and slob.c defines embedded device memory usage.

The principle behind these 3 files are almost the same, to prevent memory fragmentation and to accelerate memory alloc/dealloc same object/item/struct.

This memory management contains several definitions: cache, slab, objects. Where a cache has objects of same type, normally cache contains several slabs, a slab consists of several pages(4KiB), a slab is consist of objects.

In system, slabinfo or cat /proc/slabinfo view all kernel slabs.

猜你喜欢

转载自www.cnblogs.com/sansna/p/9359074.html