About bootmem allocation/freeing flow

yoma sophian sophian.yoma at gmail.com
Sat Apr 18 03:28:43 EDT 2015

hi all:
I have several questions about free_all_bootmem_core:

In __free_pages_bootmem, we set set_page_count(p, 0) while looping nr_pages,
why we need to set_page_refcounted(page) before calling __free_pages?

how about the pages that allocated by calling alloc_bootmem_xxxx?
in  free_all_bootmem, we just free the pages that used to record
bootmem stage present pages like below.
if so, isn't possible the pages got by calling alloc_bootmem_xxxx will
be over-written by later page allocation ?
    page = virt_to_page(bdata->node_bootmem_map);
    pages = bdata->node_low_pfn - bdata->node_min_pfn;
    pages = bootmem_bootmap_pages(pages);
    count += pages;
    while (pages--)
        __free_pages_bootmem(page++, 0);

appreciate your kind help in advance,

More information about the Kernelnewbies mailing list