From: yoma sophian <sophian.yoma@gmail.com>
To: linux-mm@kvack.org
Subject: Re: about bootmem allocation/freeing flow
Date: Fri, 24 Apr 2015 20:51:20 +0800 [thread overview]
Message-ID: <CADUS3okBFnTP2EhFHUPo1s_dHNhsP5EEgGygzrfm5xSnSQ9nDA@mail.gmail.com> (raw)
In-Reply-To: <CADUS3okX90JX3KfCf8zHvxY12b=QiU25jQBioh8LrEDVF56A-A@mail.gmail.com>
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>
prev parent reply other threads:[~2015-04-24 12:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-17 12:20 about bootmem allocation/freeing flow yoma sophian
2015-04-24 12:51 ` yoma sophian [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADUS3okBFnTP2EhFHUPo1s_dHNhsP5EEgGygzrfm5xSnSQ9nDA@mail.gmail.com \
--to=sophian.yoma@gmail.com \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).