Skip to content

Commit af2cf27

Browse files
author
Ingo Molnar
committed
x86/mm/hotplug: Don't remove PGD entries in remove_pagetable()
So when memory hotplug removes a piece of physical memory from pagetable mappings, it also frees the underlying PGD entry. This complicates PGD management, so don't do this. We can keep the PGD mapped and the PUD table all clear - it's only a single 4K page per 512 GB of memory hotplugged. Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rik van Riel <riel@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Waiman Long <Waiman.Long@hp.com> Cc: linux-mm@kvack.org Link: http://lkml.kernel.org/r/064ff6c7275734537f969e876f6cd0baa954d2cc.1468527351.git.luto@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 38452af commit af2cf27

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

arch/x86/mm/init_64.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -702,27 +702,6 @@ static void __meminit free_pmd_table(pmd_t *pmd_start, pud_t *pud)
702702
spin_unlock(&init_mm.page_table_lock);
703703
}
704704

705-
/* Return true if pgd is changed, otherwise return false. */
706-
static bool __meminit free_pud_table(pud_t *pud_start, pgd_t *pgd)
707-
{
708-
pud_t *pud;
709-
int i;
710-
711-
for (i = 0; i < PTRS_PER_PUD; i++) {
712-
pud = pud_start + i;
713-
if (!pud_none(*pud))
714-
return false;
715-
}
716-
717-
/* free a pud table */
718-
free_pagetable(pgd_page(*pgd), 0);
719-
spin_lock(&init_mm.page_table_lock);
720-
pgd_clear(pgd);
721-
spin_unlock(&init_mm.page_table_lock);
722-
723-
return true;
724-
}
725-
726705
static void __meminit
727706
remove_pte_table(pte_t *pte_start, unsigned long addr, unsigned long end,
728707
bool direct)
@@ -913,7 +892,6 @@ remove_pagetable(unsigned long start, unsigned long end, bool direct)
913892
unsigned long addr;
914893
pgd_t *pgd;
915894
pud_t *pud;
916-
bool pgd_changed = false;
917895

918896
for (addr = start; addr < end; addr = next) {
919897
next = pgd_addr_end(addr, end);
@@ -924,13 +902,8 @@ remove_pagetable(unsigned long start, unsigned long end, bool direct)
924902

925903
pud = (pud_t *)pgd_page_vaddr(*pgd);
926904
remove_pud_table(pud, addr, next, direct);
927-
if (free_pud_table(pud, pgd))
928-
pgd_changed = true;
929905
}
930906

931-
if (pgd_changed)
932-
sync_global_pgds(start, end - 1, 1);
933-
934907
flush_tlb_all();
935908
}
936909

0 commit comments

Comments
 (0)