So that the buddy allocator discussed next chapter

This preview shows page 85 - 90 out of 177 pages.

so that the buddy allocator (discussed next chapter) can build its free lists.
6.5. Retiring the Boot Memory Allocator 86 mem_init set_max_mapnr_init free_pages_init nr_free_pages test_wp_bit free_all_bootmem page_is_ram free_all_bootmem_core __free_pages do_test_wp_bit
6.5. Retiring the Boot Memory Allocator 87 Linux can free up a considerable amount of memory 3 that is used by bootstrapping code that is no longer required. 3 27 pages were freed while booting the kernel running on the machine this document is composed on.
6.5. Retiring the Boot Memory Allocator 88 init_bootmem(unsigned long start, unsigned long page) This initialises the memory between 0 and the PFN page . The begin- ning of usable memory is at the PFN start reserve_bootmem(unsigned long addr, unsigned long size) Mark the pages between the address addr and addr+size reserved. Requests to partially reserve a page will result in the full page being reserved free_bootmem(unsigned long addr, unsigned long size) Mark the pages between the address addr and addr+size free alloc_bootmem(unsigned long size) Allocate size number of bytes from ZONE_NORMAL . The allocation will be aligned to the L1 hardware cache to get the maximum benefit from the hardware cache alloc_bootmem_low(unsigned long size) Allocate size number of bytes from ZONE_DMA . The allocation will be aligned to the L1 hardware cache alloc_bootmem_pages(unsigned long size) Allocate size number of bytes from ZONE_NORMAL aligned on a page size so that full pages will be returned to the caller alloc_bootmem_low_pages(unsigned long size) Allocate size number of bytes from ZONE_NORMAL aligned on a page size so that full pages will be returned to the caller bootmem_bootmap_pages(unsigned long pages) Calculate the number of pages required to store a bitmap representing the allocation state of pages number of pages free_all_bootmem() Used at the boot allocator end of life. It cycles through all pages in the bitmap. For each one that is free, the flags are cleared and the page is freed to the physical page allocator (See next chapter) so the runtime allocator can set up its free lists Table 6.1: Boot Memory Allocator API for UMA Architectures
6.5. Retiring the Boot Memory Allocator 89 init_bootmem_node(pg_data_t *pgdat, unsigned long freepfn, unsigned long startpfn, unsigned long endpfn) For use with NUMA architectures. It initialise the memory between PFNs startpfn and endpfn with the first usable PFN at freepfn . Once initialised, the pgdat node is inserted into the pgdat_list reserve_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, unsigned long size) Mark the pages between the address addr and addr+size on the spe- cified node pgdat reserved. Requests to partially reserve a page will result in the full page being reserved free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, unsigned long size) Mark the pages between the address addr and addr+size on the spe- cified node pgdat free alloc_bootmem_node(pg_data_t *pgdat, unsigned long size) Allocate size number of bytes from ZONE_NORMAL

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture