Re: about bootmem allocation/freeing flow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2015-04-17 20:20 GMT+08:00 yoma sophian <sophian.yoma@xxxxxxxxx>:
> hi all:
> I have several questions about free_all_bootmem_core:
>
> 1.
> 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?
below is excerpted from mm/page_alloc.c  and mm/internal.h
the reason why we use set_page_refcounted(page) is because
set_page_refcounted(page) will calling VM_BUG_ON
to checking page property?

static inline void set_page_refcounted(struct page *page)
{
        VM_BUG_ON(PageTail(page));
        VM_BUG_ON(atomic_read(&page->_count));
        set_page_count(page, 1);
}

void __meminit __free_pages_bootmem(struct page *page, unsigned int order)
{
        unsigned int nr_pages = 1 << order;
        unsigned int loop;

        prefetchw(page);
        for (loop = 0; loop < nr_pages; loop++) {
                struct page *p = &page[loop];

                if (loop + 1 < nr_pages)
                        prefetchw(p + 1);
                __ClearPageReserved(p);
                set_page_count(p, 0);
        }

        page_zone(page)->managed_pages += 1 << order;
        set_page_refcounted(page);
        __free_pages(page, order);
}

appreciate your kind help,

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]