Linux Kernel Memory Management (2)
2011-05-10 14:40
225 查看
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…….
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-map,linux-memory-management,Linux-storage-stack三幅很好的图
- Linux kernel memory management (ARM)
- Linux Kernel Memory Management (1)
- Memory Allocation API In Linux Kernel && Linux Userspace、kmalloc vmalloc Difference、Kernel Large Section Memory Allocation
- Kernel Memory Layout on ARM Linux
- Linux kernel High memory
- Linux内存管理: Linux Kernel Shared Memory 剖析 Linux 内核中的内存去耦合
- Linux Kernel Shared Memory 剖析
- FAQ Linux Memory Management
- VMware: linux起步提示 memory for crashkernel(0*0 to 0*0)not within permissible
- Linux内存管理: Linux Kernel Shared Memory 剖析 Linux 内核中的内存去耦合
- 【简记】Operating System—— memory management in Linux(暂)
- Linux Kernel Shared Memory 剖析
- [译]Kernel Memory Layout on ARM Linux
- Linux kernel Process Management 1——Conparison and Contrast between linux 2.4 VS linux 2.6 in process kernel stack layout
- 《LINUX KERNEL MEMORY BARRIERS》
- Linux Memory Mapping--mmap kernel 2.6
- User-Level Memory Management in Linux Programming转
- Memory access ordering part 2 - barriers and the Linux kernel
- Feature: High Memory In The Linux Kernel