From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753195AbdEHIIh (ORCPT ); Mon, 8 May 2017 04:08:37 -0400 Received: from terminus.zytor.com ([65.50.211.136]:38597 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750797AbdEHIIf (ORCPT ); Mon, 8 May 2017 04:08:35 -0400 Date: Mon, 8 May 2017 01:01:44 -0700 From: tip-bot for Xunlei Pang Message-ID: Cc: jpoimboe@redhat.com, torvalds@linux-foundation.org, mingo@kernel.org, bp@alien8.de, yinghai@kernel.org, dyoung@redhat.com, luto@kernel.org, linux-kernel@vger.kernel.org, brgerst@gmail.com, ebiederm@xmission.com, xlpang@redhat.com, peterz@infradead.org, tglx@linutronix.de, dvlasenk@redhat.com, hpa@zytor.com Reply-To: bp@alien8.de, torvalds@linux-foundation.org, jpoimboe@redhat.com, mingo@kernel.org, dyoung@redhat.com, luto@kernel.org, yinghai@kernel.org, linux-kernel@vger.kernel.org, brgerst@gmail.com, ebiederm@xmission.com, xlpang@redhat.com, hpa@zytor.com, dvlasenk@redhat.com, tglx@linutronix.de, peterz@infradead.org In-Reply-To: <1493862171-8799-2-git-send-email-xlpang@redhat.com> References: <1493862171-8799-2-git-send-email-xlpang@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/kexec/64: Use gbpages for identity mappings if available Git-Commit-ID: 8638100c52bb7782462b14aad102a4aaf0c7094c X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 8638100c52bb7782462b14aad102a4aaf0c7094c Gitweb: http://git.kernel.org/tip/8638100c52bb7782462b14aad102a4aaf0c7094c Author: Xunlei Pang AuthorDate: Thu, 4 May 2017 09:42:51 +0800 Committer: Ingo Molnar CommitDate: Mon, 8 May 2017 08:28:44 +0200 x86/kexec/64: Use gbpages for identity mappings if available Kexec sets up all identity mappings before booting into the new kernel, and this will cause extra memory consumption for paging structures which is quite considerable on modern machines with huge memory sizes. E.g. on a 32TB machine that is kdumping, it could waste around 128MB (around 4MB/TB) from the reserved memory after kexec sets all the identity mappings using the current 2MB page. Add to that the memory needed for the loaded kdump kernel, initramfs, etc., and it causes a kexec syscall -NOMEM failure. As a result, we had to enlarge reserved memory via "crashkernel=X" to work around this problem. This causes some trouble for distributions that use policies to evaluate the proper "crashkernel=X" value for users. So enable gbpages for kexec mappings. Signed-off-by: Xunlei Pang Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dave Young Cc: Denys Vlasenko Cc: Eric Biederman Cc: H. Peter Anvin Cc: Josh Poimboeuf Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Yinghai Lu Cc: akpm@linux-foundation.org Cc: kexec@lists.infradead.org Link: http://lkml.kernel.org/r/1493862171-8799-2-git-send-email-xlpang@redhat.com Signed-off-by: Ingo Molnar --- arch/x86/kernel/machine_kexec_64.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c index 1d4f2b0..c25d277 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c @@ -122,6 +122,10 @@ static int init_pgtable(struct kimage *image, unsigned long start_pgtable) level4p = (pgd_t *)__va(start_pgtable); clear_page(level4p); + + if (direct_gbpages) + info.direct_gbpages = true; + for (i = 0; i < nr_pfn_mapped; i++) { mstart = pfn_mapped[i].start << PAGE_SHIFT; mend = pfn_mapped[i].end << PAGE_SHIFT;