Linux????е????
???????????? ???????[ 2012/12/17 10:28:16 ] ????????
?????
????????????????????????????λ?????????????С??????λ????????????MMU??????????????????沢????????????????????????????????????λ???д?????????32λ????????4KB??????????struct page???????????????????page???????????????????????????????????????????????????????????????????????????????????????
??????
??????????Щ?λ??????????????????????????????????Щ????????????????????????????????ZONE_DMA??ZONE_DMA32??ZONE_NORMAL??ZONE_HIGHMEM???????棬???е???????????????????????????????struct zone????????????32λ??X86???ZONE_DMA?????????0-16MB????淶Χ??ZONE_NORMAL???16MB??896MB????????????棬ZONE_HIGHMEM?????896MB????????????檔?????????????????е?????????????????????????X86-64???ZONE_HIGHMEM????
????????????????λ??????????????????????????????????Щ?????????????á?alloc_page????????????+page_address=__get_free_pages?????????????????
???????????????????????????????????????????????????????kmalloc?????????????????????????GFP_KERNEL??GPF_ATOMIC??????GPF_ATOMIC?????ж????????°????????????????????????????????GPF_KERNEL????÷????????????????????????????????????????У?GPF_NOIO?????????????????????????????I/O??
?????????????????????????????????????????????????vmalloc?????????????????????????????????????vmalloc?????????????????????????±??????????????TLB???????·???棬????????????????????????????????????????????????????ú???????????????????????????????鶯??????
???????????????????з???????????????棨??????????896MB???е???????3GB-4GB?????????????alloc_pages???????????????__get_free_pages??kmalloc?????????????????????????????????????page?????????????????????浱??п???????????????????????????????????????????????????kmap?????????????????????????????????????????????????????????????????????????????????????????kunmap??????????????????????????????????????kmap_atomic?????????????????????????ж????????У?????????kunmap_atomic??????
?????????????????????????????????????????slab????????????????????????????????????Slab??????????????????棬???????????????????????????????У????????????μ?????????????????slab????????????????????棬???????????????е?????????
????Slab????????????????????飬?????????????д?????????????????????????????????檔?????????????????????slab??slab????????????????????????ɡ????slab???????????????????????????????????????????????μ?????????????????slab?н??з????????в???????slab??????slab?н??з????????п??slab??????????slab?????????????????????????????struct kmem_cache??????????slab???struct slab???塣
????Slab???????????
????struct kmem_cache *task_struct_cachep;
????task_struct_cachep=kmem_cache_create??“task_struct”??sizeof??task_struct????ARCH_MIN_TASKALIGN??SLAB_PANIC|SLAB_NOTRACK??NULL??; //???????????
????struct task_struct *tsk;
????tsk=kmem_cache_alloc??task_struct_cachep??GPF_KERNEL??; //??????з???
????…..
????kmem_cache_free??task_struct_cachep??tsk??; //??????????
????kmem_cache_destroy??task_struct_cachep??; //???????????
????????
???????????????????????????32λ??64λ???????????С?????4KB??8KB?????????????С?????8KB??16KB??????????????????????????????????????????????????????????????????????ж???????????????????????????????????????ж??????????????ж?????????ж??????????????ж??????????????????????????????????1????????2???????С?????4-16KB???Χ?????????ж??????????ж????????????????????1?????????ж?????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11