Linux Kernel Memory Management (2)
来源:互联网 发布:淘宝店铺怎么关闭啊 编辑:程序博客网 时间:2024/05/16 10:57
Author: Harold Wang
http://blog.csdn.net/hero7935
1.Slab Allocator
Three Layer architecture:
--Cache
--Slab
--Object
1.1 Caches
General cache
--kmem_cache_init() and kmem_cache_sizes_init() to establish general cache when system initializing.
--kmalloc() function to allocate object
Specific cache
--caches that are frequently used.
--kmem_cache_create() function to create specific cache
Author: Harold Wang
http://blog.csdn.net/hero7935
/proc/slabinfo to illustrate the general cache and specific cache in the system.
Linux 2.6 involves per-CPU data structure(struct array_cache which is slab local cache) to reduce spin lock contention among processors and to make better use of the hardware caches, Most allocations and releases of slab objects affects the local cache only!
Cache Descriptor
struct kmem_cache
{
struct kmem_list3* nodelists[MAX_NUMNODES];
/*constructor func*/
/*de-constructor func*/
struct list_head next;
}
struct kmem_list3
{
struct list_head slabs_partial; /* list of slab descriptors with both free and non-free objects */
struct list_head slabs_full; /* list of slab descriptors with non-free objects */
struct list_head slabs_free; /* list of slab descriptors with free objects only */
unsigned long free_objects;/*number of objects available in kmem_list3*/
unsigned int free_limit;/*maxmimum of objects in kmem_list3*/
/*other functions*/
}
struct slab
{
struct list_head list;
unsigned long colouroff;/*offset(in bytes) of the first object in a Slab*/
void* s_mem;/*Address of first object in the slab*/
unsigned int inuse;
kmem_bufctl_t free;/*Index of next free object in the slab, or BUFCTL_END if there are no free objects left*/
}
All caches are orgnised by double-linked chain and pointed by cache_chain.
Author: Harold Wang
http://blog.csdn.net/hero7935
1.2 Slabs and objects
Slub allocation:
Noncontiguous memory area management(updating)
Process address space
Process-Related Memory Structures
Process Memory Layout
Linux Process Page Table
Author: Harold Wang
http://blog.csdn.net/hero7935
updating…….
- Linux Kernel Memory Management (2)
- Linux Kernel Memory Management (1)
- Linux kernel memory management (ARM)
- 【Linux】Linux Kernel--Memory Management(一)
- 【Linux】Linux Kernel--Memory Management(二)
- FAQ Linux Memory Management
- Linux Memory Management Notes
- Linux memory management
- Linux Memory Management
- Linux kernel management style
- linux kernel time management
- linux-kernel-map,linux-memory-management,Linux-storage-stack三幅很好的图
- Linux kernel memory management buddy system (linux内核内存管理的伙伴算法)
- Linux kernel Memory Barrier
- Linux kernel High memory
- memory management 2
- iOS memory management 2
- Memory Management(2)
- Flash ActionScript 3.0 学习开篇
- Android 程序的安装、卸载和更新
- ZendServer 在Win7环境中安装的几个问题
- IBUS输入法安装和设置
- UI Table View Controller浅析
- Linux Kernel Memory Management (2)
- Wireshark图解教程--介绍界面、两个菜单以及capture filter的语法
- Wireshark图解教程--介绍界面、两个菜单以及capture filter的语法
- 1
- Android 中关于 【Cursor】 类的介绍
- SSH中用apache的jxl.jar导入导出Excel表格
- javascript 动态增加行列
- Sybil attack
- LVS+Keepalived实现高可用集群