struct kmem_cache {
/* 1) per-cpu data, touched during every alloc/free */
/*per-CPU数据,记录了本地高速缓存的信息,也用于跟踪最近释放的对象,每次分配和释放都要直接访问它*/
struct array_cache *array[NR_CPUS];
/* 2) Cache tunables. Protected by cache_chain_mutex */
unsigned int batchcount; /*本地高速缓存转入或转出的大批对象数量*/
unsigned int limit; /*本地高速缓存中空闲对象的最大数目*/
unsigned int shared;
unsigned int buffer_size;/*管理对象的大小*/
u32 reciprocal_buffer_size;/*buffer_size的倒数值*/
/* 3) touched by every alloc & free from the backend */
unsigned int flags; /* 高速缓存的永久标识*/
unsigned int num; /* 一个slab所包含的对象数目 */
/* 4) cache_grow/shrink */
/* order of pgs per slab (2^n) */
unsigned int gfporder; /*一个slab包含的连续页框数的对数*/
/* force GFP flags, e.g. GFP_DMA */
gfp_t gfpflags; /*与伙伴系统交互时所提供的分配标识*/
size_t colour; /* 颜色的个数*/
unsigned int colour_off; /* 着色的偏移量 */
/*如果将slab描述符存储在外部,该指针指向存储slab描述符的cache,
否则为NULL*/
struct kmem_cache *slabp_cache;
unsigned int slab_size; /*slab管理区的大小*/
unsigned int dflags; /*动态标识*/
/* constructor func */
void (*ctor)(void *obj); /*创建高速缓存时的构造函数指针*/
/* 5) cache creation/removal */
const char *name; /*高速缓存名*/
struct list_head next; /*用于将高速缓存链入cache chain*/
/* 6) statistics */
#ifdef CONFIG_DEBUG_SLAB /*一些用于调试用的变量*/
unsigned long num_active;
unsigned long num_allocations;
unsigned long high_mark;
unsigned long grown;
unsigned long reaped;
unsigned long errors;
unsigned long max_freeable;
unsigned long node_allocs;
unsigned long node_frees;
unsigned long node_overflow;
atomic_t allochit;
atomic_t allocmiss;
atomic_t freehit;
atomic_t freemiss;
/*
* If debugging is enabled, then the allocator can add additional
* fields and/or padding to every object. buffer_size contains the total
* object size including these internal fields, the following two
* variables contain the offset to the user object and its size.
*/
int obj_offset;
int obj_size;
#endif /* CONFIG_DEBUG_SLAB */
/*
* We put nodelists[] at the end of kmem_cache, because we want to size
* this array to nr_node_ids slots instead of MAX_NUMNODES
* (see kmem_cache_init())
* We still use [MAX_NUMNODES] and not [1] or [0] because cache_cache
* is statically defined, so we reserve the max number of nodes.
*/
/*struct kmem_list3用于组织该高速缓存中的slab*/
struct kmem_list3 *nodelists[MAX_NUMNODES];
/*
* Do not add fields after nodelists[]
*/
};
12345678910111213
struct kmem_list3 {
struct list_head slabs_partial;/*slab链表,包含空闲对象和已分配对象的slab描述符*/
struct list_head slabs_full; /*slab链表,只包含非空闲的slab描述符*/
struct list_head slabs_free; /*slab链表,只包含空闲的slab描述符*/
unsigned long free_objects; /*高速缓存中空闲对象的个数*/
unsigned int free_limit; /*空闲对象的上限*/
unsigned int colour_next; /*下一个slab使用的颜色*/
spinlock_t list_lock;
struct array_cache *shared; /* shared per node */
struct array_cache **alien; /* on other nodes */
unsigned long next_reap; /* updated without locking */
int free_touched; /* updated without locking */
};
描述和管理单个slab的结构是struct slab
12345678
struct slab {
struct list_head list; /*用于将slab链入kmem_list3的链表*/
unsigned long colouroff;/*该slab的着色偏移*/
void *s_mem; /*指向slab中的第一个对象*/
unsigned int inuse; /*已分配出去的对象*/
kmem_bufctl_t free; /*下一个空闲对象的下标*/
unsigned short nodeid; /*节点标识号*/
};
高级配置与电源管理接口(Advanced Configuration and Power Interface)是提供操作系统与应用程序管理所有电源管理接口,包括了各种软件和硬件方面的规范。2004年推出3.0规范;2009年推出4.0规范;2011年推出5.0规范。2013年之后新的ACPI规格将由UEFI论坛制定。ACPI可以实现的功能包括:电源管理;性能管理;配置与即插即用;系统事件;温度管理;电池管理;SMBus控制器;嵌入式控制器。
[HW,ACPI]
acpi={force|off|noirq|strict|rsdt|nocmcff|copy_dsdt}
ACPI的总开关。
force 表示强制启用ACPI(即使BIOS中已关闭);
off 表示强制禁用ACPI(即使BIOS中已开启);
noirq 表示不要将ACPI用于IRQ路由;
strict 表示严格要求系统遵循ACPI规格(降低兼容性);
rsdt 表示使用老旧的RSDT(Root System Description Table)代替较新的XSDT(Extended System Description Table);
copy_dsdt 表示将DSDT(Differentiated System Description Table)复制到内存中。
更多信息可参考Documentation/power/runtime_pm.txt以及"pci=noacpi"。
[HW,ACPI]
acpi_backlight={vendor|video}
选择屏幕背光亮度调节驱动。
video(默认值)表示使用通用的ACPI video.ko驱动(CONFIG_ACPI_VIDEO),该驱动仅可用于集成显卡。
vendor表示使用厂商特定的ACPI驱动(thinkpad_acpi,sony_acpi等)。
详见Documentation/acpi/video_extension.txt文档。
[HW,ACPI]
acpi_os_name="字符串"
告诉ACPI BIOS操作系统的名称。
常用于哄骗有缺陷的BIOS,让其以为运行的是Windows系统而不是Linux系统。
"Linux" = Linux
"Microsoft Windows" = Windows 98
"Windows 2000" = Windows 2000
"Windows 2001" = Windows XP
"Windows 2001 SP2" = Windows XP SP2
"Windows 2001.1" = Windows Server 2003
"Windows 2001.1 SP1" = Windows Server 2003 SP1
"Windows 2006" = Windows Vista
"Windows 2006 SP1" = Windows Vista SP1
"Windows 2006.1" = Windows Server 2008
"Windows 2009" = Windows 7 / Windows Server 2008 R2
"Windows 2012" = Windows 8 / Windows Server 2012
"Windows 2013" = Windows 8.1 / Windows Server 2012 R2
[HW,ACPI]
acpi_osi="字符串"
对于较新的内核(Linux-2.6.23之后)而言,当BIOS询问内核:"你是Linux吗?",内核都会回答"No",但历史上(Linux-2.6.22及更早版本)内核会如实回答"Yes",结果造成很多BIOS兼容性问题(主要是电源管理方面)。具体故事的细节请到内核源码文件drivers/acpi/osl.c中搜索"The story of _OSI(Linux)"注释。
此参数用于修改内核中的操作系统接口字符串(_OSI string)列表默认值,这样当BIOS向内核询问:"你是xxx吗?"的时候,内核就可以根据修改后的列表中是否存在"xxx"回答"Yes"或"No"了,主要用于解决BIOS兼容性问题导致的故障(例如屏幕亮度调整)。
acpi_osi="Linux"表示添加"Linux";
acpi_osi="!Linux"表示删除"Linux";
acpi_osi=!* 表示删除所有字符串(v3.13新增),可以和多个acpi_osi="Linux"格式联合使用;
acpi_osi=! 表示删除所有内置的字符串(v3.13新增),可以和多个acpi_osi="Linux"格式联合使用;
acpi_osi= 表示禁用所有字符串,仅可单独使用(不能联合使用)。
[HW,ACPI]
acpi_serialize
强制内核以串行方式执行AML(ACPI Machine Language)字节码。用于解决某些有缺陷的BIOS导致的故障。
[ACPI]
acpi_enforce_resources={strict|lax|no}
检查驱动程序和ACPI操作区域(SystemIO,SystemMemory)之间资源冲突的方式。
strict(默认值)禁止任何驱动程序访问已被ACPI声明为"受保护"的操作区域,这是最安全的方式,可以从根本上避免冲突。
lax允许驱动程序访问已被ACPI声明的保护区域(但会显示一个警告)。这可能会造成冲突,但是可以兼容某些老旧且脑残的驱动程序(例如某些硬件监控驱动)。
no表示根本不声明任何ACPI保护区域,也就是完全允许任意驱动程序访问ACPI操作区域。
[ACPI]
pnpacpi=off
禁用ACPI的即插即用功能,转而使用古董的PNPBIOS来代替。