linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Freeing page table pages
@ 2018-06-28  5:31 Anshuman Khandual
  0 siblings, 0 replies; only message in thread
From: Anshuman Khandual @ 2018-06-28  5:31 UTC (permalink / raw)
  To: Linux Memory Management List; +Cc: Michal Hocko, Andrew Morton

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-06-28  5:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-28  5:31 Freeing page table pages Anshuman Khandual

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox