Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1423600

[PATCH 01/13] x86/mm/hotplug: Don't remove PGD entries in remove_pagetable()

From Andy Lutomirski <luto@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 01/13] x86/mm/hotplug: Don't remove PGD entries in remove_pagetable()
Date 2016-06-16 02:30 +0200
Message-ID <rKtm2-1aF-29@gated-at.bofh.it> (permalink)
References <rKtm1-1aF-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Ingo Molnar <mingo@kernel.org>

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.

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: 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
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Message-Id: <1442903021-3893-4-git-send-email-mingo@kernel.org>
---
 arch/x86/mm/init_64.c | 27 ---------------------------
 1 file changed, 27 deletions(-)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index bce2e5d9edd4..c7465453d64e 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -702,27 +702,6 @@ static void __meminit free_pmd_table(pmd_t *pmd_start, pud_t *pud)
 	spin_unlock(&init_mm.page_table_lock);
 }
 
-/* Return true if pgd is changed, otherwise return false. */
-static bool __meminit free_pud_table(pud_t *pud_start, pgd_t *pgd)
-{
-	pud_t *pud;
-	int i;
-
-	for (i = 0; i < PTRS_PER_PUD; i++) {
-		pud = pud_start + i;
-		if (pud_val(*pud))
-			return false;
-	}
-
-	/* free a pud table */
-	free_pagetable(pgd_page(*pgd), 0);
-	spin_lock(&init_mm.page_table_lock);
-	pgd_clear(pgd);
-	spin_unlock(&init_mm.page_table_lock);
-
-	return true;
-}
-
 static void __meminit
 remove_pte_table(pte_t *pte_start, unsigned long addr, unsigned long end,
 		 bool direct)
@@ -913,7 +892,6 @@ remove_pagetable(unsigned long start, unsigned long end, bool direct)
 	unsigned long addr;
 	pgd_t *pgd;
 	pud_t *pud;
-	bool pgd_changed = false;
 
 	for (addr = start; addr < end; addr = next) {
 		next = pgd_addr_end(addr, end);
@@ -924,13 +902,8 @@ remove_pagetable(unsigned long start, unsigned long end, bool direct)
 
 		pud = (pud_t *)pgd_page_vaddr(*pgd);
 		remove_pud_table(pud, addr, next, direct);
-		if (free_pud_table(pud, pgd))
-			pgd_changed = true;
 	}
 
-	if (pgd_changed)
-		sync_global_pgds(start, end - 1, 1);
-
 	flush_tlb_all();
 }
 
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/13] Virtually mapped stacks with guard pages (x86, core) Andy Lutomirski <luto@kernel.org> - 2016-06-16 02:30 +0200
  [PATCH 01/13] x86/mm/hotplug: Don't remove PGD entries in remove_pagetable() Andy Lutomirski <luto@kernel.org> - 2016-06-16 02:30 +0200
  [PATCH 12/13] x86/mm/64: Enable vmapped stacks Andy Lutomirski <luto@kernel.org> - 2016-06-16 02:30 +0200
    Re: [PATCH 12/13] x86/mm/64: Enable vmapped stacks Andy Lutomirski <luto@amacapital.net> - 2016-06-16 07:40 +0200
      Re: [kernel-hardening] Re: [PATCH 12/13] x86/mm/64: Enable vmapped  stacks Rik van Riel <riel@redhat.com> - 2016-06-16 15:20 +0200
  [PATCH 03/13] x86/cpa: Warn if kernel_unmap_pages_in_pgd is used inappropriately Andy Lutomirski <luto@kernel.org> - 2016-06-16 02:30 +0200
  [PATCH 08/13] x86/dumpstack: When OOPSing, rewind the stack before do_exit Andy Lutomirski <luto@kernel.org> - 2016-06-16 02:40 +0200
    Re: [PATCH 08/13] x86/dumpstack: When OOPSing, rewind the stack  before do_exit Josh Poimboeuf <jpoimboe@redhat.com> - 2016-06-16 20:00 +0200
      Re: [PATCH 08/13] x86/dumpstack: When OOPSing, rewind the stack  before do_exit Andy Lutomirski <luto@amacapital.net> - 2016-06-16 20:00 +0200
  [PATCH 02/13] x86/cpa: In populate_pgd, don't set the pgd entry until it's populated Andy Lutomirski <luto@kernel.org> - 2016-06-16 02:40 +0200
  [PATCH 06/13] fork: Add generic vmalloced stack support Andy Lutomirski <luto@kernel.org> - 2016-06-16 02:40 +0200
    Re: [PATCH 06/13] fork: Add generic vmalloced stack support Kees Cook <keescook@chromium.org> - 2016-06-16 19:30 +0200
      Re: [PATCH 06/13] fork: Add generic vmalloced stack support Andy Lutomirski <luto@amacapital.net> - 2016-06-16 19:40 +0200
  [PATCH 07/13] x86/die: Don't try to recover from an OOPS on a non-default stack Andy Lutomirski <luto@kernel.org> - 2016-06-16 02:40 +0200
  [PATCH 10/13] x86/dumpstack: Try harder to get a call trace on stack overflow Andy Lutomirski <luto@kernel.org> - 2016-06-16 02:40 +0200
    Re: [PATCH 10/13] x86/dumpstack: Try harder to get a call trace on  stack overflow Josh Poimboeuf <jpoimboe@redhat.com> - 2016-06-16 20:20 +0200
      Re: [PATCH 10/13] x86/dumpstack: Try harder to get a call trace on  stack overflow Andy Lutomirski <luto@amacapital.net> - 2016-06-16 20:30 +0200
        Re: [PATCH 10/13] x86/dumpstack: Try harder to get a call trace on  stack overflow Andy Lutomirski <luto@amacapital.net> - 2016-06-16 20:40 +0200
          Re: [PATCH 10/13] x86/dumpstack: Try harder to get a call trace on  stack overflow Josh Poimboeuf <jpoimboe@redhat.com> - 2016-06-16 21:00 +0200
        Re: [PATCH 10/13] x86/dumpstack: Try harder to get a call trace on  stack overflow Josh Poimboeuf <jpoimboe@redhat.com> - 2016-06-16 20:40 +0200
  Re: [PATCH 00/13] Virtually mapped stacks with guard pages (x86,  core) Heiko Carstens <heiko.carstens@de.ibm.com> - 2016-06-16 08:10 +0200
    Re: [PATCH 00/13] Virtually mapped stacks with guard pages (x86, core) Andy Lutomirski <luto@amacapital.net> - 2016-06-16 20:00 +0200
      Re: [PATCH 00/13] Virtually mapped stacks with guard pages (x86, core) Andy Lutomirski <luto@amacapital.net> - 2016-06-16 20:20 +0200
        Re: [PATCH 00/13] Virtually mapped stacks with guard pages (x86, core) Andy Lutomirski <luto@amacapital.net> - 2016-06-16 23:30 +0200
    Re: [PATCH 00/13] Virtually mapped stacks with guard pages (x86, core) Andy Lutomirski <luto@amacapital.net> - 2016-06-17 06:00 +0200
      Re: [PATCH 00/13] Virtually mapped stacks with guard pages (x86,  core) Heiko Carstens <heiko.carstens@de.ibm.com> - 2016-06-17 09:30 +0200
        Re: [PATCH 00/13] Virtually mapped stacks with guard pages (x86, core) Andy Lutomirski <luto@amacapital.net> - 2016-06-17 19:40 +0200
          Re: [PATCH 00/13] Virtually mapped stacks with guard pages (x86,  core) Heiko Carstens <heiko.carstens@de.ibm.com> - 2016-06-20 08:00 +0200
            Re: [PATCH 00/13] Virtually mapped stacks with guard pages (x86, core) Andy Lutomirski <luto@amacapital.net> - 2016-06-20 08:10 +0200
              Re: [PATCH 00/13] Virtually mapped stacks with guard pages (x86,  core) Heiko Carstens <heiko.carstens@de.ibm.com> - 2016-06-20 09:40 +0200
  Re: [PATCH 00/13] Virtually mapped stacks with guard pages (x86, core) Kees Cook <keescook@chromium.org> - 2016-06-16 19:30 +0200

csiph-web