本文共 1130 字,大约阅读时间需要 3 分钟。
主要还是两个函数free_bootmem_node和free_bootmem
这里主要是标记相应比特位为0,空闲。
/** * free_bootmem_node - mark a page range as usable * @pgdat: node the range resides on * @physaddr: starting address of the range * @size: size of the range in bytes * * Partial pages will be considered reserved and left as they are. * * The range must reside completely on the specified node. */void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, unsigned long size){ unsigned long start, end; kmemleak_free_part_phys(physaddr, size); start = PFN_UP(physaddr); end = PFN_DOWN(physaddr + size); mark_bootmem_node(pgdat->bdata, start, end, 0, 0);}
/** * free_bootmem - mark a page range as usable * @addr: starting physical address of the range * @size: size of the range in bytes * * Partial pages will be considered reserved and left as they are. * * The range must be contiguous but may span node boundaries. */void __init free_bootmem(unsigned long physaddr, unsigned long size){ unsigned long start, end; kmemleak_free_part_phys(physaddr, size); start = PFN_UP(physaddr); end = PFN_DOWN(physaddr + size); mark_bootmem(start, end, 0, 0);}
转载地址:http://zqqti.baihongyu.com/