All of lore.kernel.org
 help / color / mirror / Atom feed
* about bootmem allocation/freeing flow
@ 2015-04-17 12:20 yoma sophian
  2015-04-24 12:51 ` yoma sophian
  0 siblings, 1 reply; 4+ messages in thread
From: yoma sophian @ 2015-04-17 12:20 UTC (permalink / raw)
  To: linux-mm

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?

2.
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,

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: about bootmem allocation/freeing flow
  2015-04-17 12:20 about bootmem allocation/freeing flow yoma sophian
@ 2015-04-24 12:51 ` yoma sophian
  0 siblings, 0 replies; 4+ messages in thread
From: yoma sophian @ 2015-04-24 12:51 UTC (permalink / raw)
  To: linux-mm

2015-04-17 20:20 GMT+08:00 yoma sophian <sophian.yoma@gmail.com>:
> 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@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* About bootmem allocation/freeing flow
  2015-04-18  7:28 About " yoma sophian
@ 2015-05-05 17:50 ` yoma sophian
  0 siblings, 0 replies; 4+ messages in thread
From: yoma sophian @ 2015-05-05 17:50 UTC (permalink / raw)
  To: kernelnewbies

2015-04-18 15:28 GMT+08:00 yoma sophian <sophian.yoma@gmail.com>:
> 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);
}

thanks for your help,

^ permalink raw reply	[flat|nested] 4+ messages in thread

* About bootmem allocation/freeing flow
@ 2015-04-18  7:28 yoma sophian
  2015-05-05 17:50 ` yoma sophian
  0 siblings, 1 reply; 4+ messages in thread
From: yoma sophian @ 2015-04-18  7:28 UTC (permalink / raw)
  To: kernelnewbies

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?

2.
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,

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-05 17:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-17 12:20 about bootmem allocation/freeing flow yoma sophian
2015-04-24 12:51 ` yoma sophian
2015-04-18  7:28 About " yoma sophian
2015-05-05 17:50 ` yoma sophian

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.