From: Anshuman Khandual <khandual@linux.vnet.ibm.com>
To: Linux Memory Management List <linux-mm@kvack.org>
Cc: Michal Hocko <mhocko@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Freeing page table pages
Date: Thu, 28 Jun 2018 11:01:30 +0530 [thread overview]
Message-ID: <91ea4760-b793-2765-f59a-a09d730c0624@linux.vnet.ibm.com> (raw)
Hello,
Here is pagetable free function from x86 architecture (arch/x86/mm/init_64.c)
static void __meminit free_pagetable(struct page *page, int order)
{
unsigned long magic;
unsigned int nr_pages = 1 << order;
/* bootmem page has reserved flag */
if (PageReserved(page)) {
__ClearPageReserved(page);
magic = (unsigned long)page->freelist;
if (magic == SECTION_INFO || magic == MIX_SECTION_INFO) {
while (nr_pages--)
put_page_bootmem(page++);
} else
while (nr_pages--)
free_reserved_page(page++);
} else
free_pages((unsigned long)page_address(page), order);
}
Since all kernel pagetable pages allocated during boot from memblock should
have been marked with MIX_SECTION_INFO through the following function calls,
wondering in which case if (magic == SECTION_INFO || magic == MIX_SECTION_INFO)
will evaluate to be false and will directly call free_reserved_page() instead.
Inside register_page_bootmem_memmap() (arch/x86/mm/init_64.c)
get_page_bootmem(section_nr, pgd_page(*pgd), MIX_SECTION_INFO);
get_page_bootmem(section_nr, p4d_page(*p4d), MIX_SECTION_INFO);
get_page_bootmem(section_nr, pud_page(*pud), MIX_SECTION_INFO);
get_page_bootmem(section_nr, pte_page(*pte), SECTION_INFO);
- Anshuman
reply other threads:[~2018-06-28 5:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=91ea4760-b793-2765-f59a-a09d730c0624@linux.vnet.ibm.com \
--to=khandual@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.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