x86/mm: Reduce PAE-mode per task pgd allocation overhead from 4K to 32 bytes
authorFenghua Yu <fenghua.yu@intel.com>
Fri, 16 Jan 2015 04:30:01 +0000 (20:30 -0800)
committerIngo Molnar <mingo@kernel.org>
Thu, 19 Feb 2015 00:28:38 +0000 (01:28 +0100)
commit1db491f77b6ed0f32f1d4a3ac40a5be9524f1914
treec557ac214ef03fc4d7171244b11cb030bc4b7197
parente07e0d4cb0c4bfe822ec8491cc06269096a38bea
x86/mm: Reduce PAE-mode per task pgd allocation overhead from 4K to 32 bytes

With more embedded systems emerging using Quark, among other
things, 32-bit kernel matters again. 32-bit machine and kernel
uses PAE paging, which currently wastes at least 4K of memory
per process on Linux where we have to reserve an entire page to
support a single 32-byte PGD structure. It would be a very good
thing if we could eliminate that wastage.

PAE paging is used to access more than 4GB memory on x86-32. And
it is required for NX.

In this patch, we still allocate one page for pgd for a Xen
domain and 64-bit kernel because one page pgd is assumed in
these cases. But we can save memory space by only allocating
32-byte pgd for 32-bit PAE kernel when it is not running as a
Xen domain.

Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Christoph Lameter <cl@linux.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Glenn Williamson <glenn.p.williamson@intel.com>
Cc: H. Peter Anvin <hpa@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1421382601-46912-1-git-send-email-fenghua.yu@intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/mm/pgtable.c