From: "tip-bot for Jérôme Glisse" <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: luto@kernel.org, linux-kernel@vger.kernel.org, mingo@kernel.org,
kirill.shutemov@linux.intel.com, tglx@linutronix.de,
jglisse@redhat.com, hpa@zytor.com, akpm@linux-foundation.org,
peterz@infradead.org, logang@deltatee.com,
torvalds@linux-foundation.org
Subject: [tip:x86/urgent] x86/mm/hotplug: Fix BUG_ON() after hot-remove by not freeing PUD
Date: Tue, 27 Jun 2017 00:19:10 -0700 [thread overview]
Message-ID: <tip-98fe3633c5a44e5ee3d642907739eb0210407886@git.kernel.org> (raw)
In-Reply-To: <20170624180514.3821-1-jglisse@redhat.com>
Commit-ID: 98fe3633c5a44e5ee3d642907739eb0210407886
Gitweb: http://git.kernel.org/tip/98fe3633c5a44e5ee3d642907739eb0210407886
Author: Jérôme Glisse <jglisse@redhat.com>
AuthorDate: Sat, 24 Jun 2017 14:05:14 -0400
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 26 Jun 2017 11:44:19 +0200
x86/mm/hotplug: Fix BUG_ON() after hot-remove by not freeing PUD
Since commit:
af2cf278ef4f ("x86/mm/hotplug: Don't remove PGD entries in remove_pagetable()")
we no longer free PUDs so that we do not have to synchronize
all PGDs on hot-remove/vfree().
But the new 5-level page table patchset reverted that for 4-level
page tables, in the following commit:
f2a6a7050109: ("x86: Convert the rest of the code to support p4d_t")
This patch restores the damage and disables free_pud() if we are in the
4-level page table case, thus avoiding BUG_ON() after hot-remove.
Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
[ Clarified the changelog and the code comments. ]
Reviewed-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Logan Gunthorpe <logang@deltatee.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/20170624180514.3821-1-jglisse@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/mm/init_64.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 95651dc..0a59daf 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -990,7 +990,13 @@ remove_p4d_table(p4d_t *p4d_start, unsigned long addr, unsigned long end,
pud_base = pud_offset(p4d, 0);
remove_pud_table(pud_base, addr, next, direct);
- free_pud_table(pud_base, p4d);
+ /*
+ * For 4-level page tables we do not want to free PUDs, but in the
+ * 5-level case we should free them. This code will have to change
+ * to adapt for boot-time switching between 4 and 5 level page tables.
+ */
+ if (CONFIG_PGTABLE_LEVELS == 5)
+ free_pud_table(pud_base, p4d);
}
if (direct)
prev parent reply other threads:[~2017-06-27 7:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-24 18:05 [PATCH] x86/mm/hotplug: fix BUG_ON() after hotremove by not freeing pud v3 jglisse
2017-06-26 9:43 ` Ingo Molnar
2017-06-26 14:49 ` Jerome Glisse
2017-06-27 7:19 ` tip-bot for Jérôme Glisse [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=tip-98fe3633c5a44e5ee3d642907739eb0210407886@git.kernel.org \
--to=tipbot@zytor.com \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=jglisse@redhat.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=logang@deltatee.com \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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).