WSL2-Linux-Kernel/arch
Daniel Jordan fe124c95df x86/mm: use max memory block size on bare metal
Some of our servers spend significant time at kernel boot initializing
memory block sysfs directories and then creating symlinks between them and
the corresponding nodes.  The slowness happens because the machines get
stuck with the smallest supported memory block size on x86 (128M), which
results in 16,288 directories to cover the 2T of installed RAM.  The
search for each memory block is noticeable even with commit 4fb6eabf10
("drivers/base/memory.c: cache memory blocks in xarray to accelerate
lookup").

Commit 078eb6aa50 ("x86/mm/memory_hotplug: determine block size based on
the end of boot memory") chooses the block size based on alignment with
memory end.  That addresses hotplug failures in qemu guests, but for bare
metal systems whose memory end isn't aligned to even the smallest size, it
leaves them at 128M.

Make kernels that aren't running on a hypervisor use the largest supported
size (2G) to minimize overhead on big machines.  Kernel boot goes 7%
faster on the aforementioned servers, shaving off half a second.

[daniel.m.jordan@oracle.com: v3]
  Link: http://lkml.kernel.org/r/20200714205450.945834-1-daniel.m.jordan@oracle.com

Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Sistare <steven.sistare@oracle.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20200609225451.3542648-1-daniel.m.jordan@oracle.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-08-12 10:57:57 -07:00
..
alpha asm-generic: pgalloc: provide generic pgd_free() 2020-08-07 11:33:26 -07:00
arc Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-08-09 13:33:54 -07:00
arm Kbuild updates for v5.9 2020-08-09 14:10:26 -07:00
arm64 - Fix tegra194-cpufreq module build failure caused __cpu_logical_map 2020-08-08 14:16:12 -07:00
c6x Merge branch 'work.regset' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-08-07 09:29:25 -07:00
csky Merge branch 'akpm' (patches from Andrew) 2020-08-07 11:39:33 -07:00
h8300 Merge branch 'work.regset' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-08-07 09:29:25 -07:00
hexagon Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-08-09 13:33:54 -07:00
ia64 A set of locking fixes and updates: 2020-08-10 19:07:44 -07:00
m68k Merge branch 'akpm' (patches from Andrew) 2020-08-07 11:39:33 -07:00
microblaze mm/sparse: cleanup the code surrounding memory_present() 2020-08-07 11:33:27 -07:00
mips Kbuild updates for v5.9 2020-08-09 14:10:26 -07:00
nds32 Merge branch 'akpm' (patches from Andrew) 2020-08-07 11:39:33 -07:00
nios2 Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-08-09 13:33:54 -07:00
openrisc Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-08-09 13:33:54 -07:00
parisc A set of locking fixes and updates: 2020-08-10 19:07:44 -07:00
powerpc Kbuild updates for v5.9 2020-08-09 14:10:26 -07:00
riscv Merge branch 'akpm' (patches from Andrew) 2020-08-07 11:39:33 -07:00
s390 Kbuild updates for v5.9 2020-08-09 14:10:26 -07:00
sh A set of locking fixes and updates: 2020-08-10 19:07:44 -07:00
sparc A set of locking fixes and updates: 2020-08-10 19:07:44 -07:00
um Kbuild updates for v5.9 2020-08-09 14:10:26 -07:00
x86 x86/mm: use max memory block size on bare metal 2020-08-12 10:57:57 -07:00
xtensa Kbuild updates for v5.9 2020-08-09 14:10:26 -07:00
.gitignore
Kconfig Kbuild updates for v5.9 2020-08-09 14:10:26 -07:00