linux-stable/arch/x86
Saravanan D 575299ea18 x86/mm: track linear mapping split events
To help with debugging the sluggishness caused by TLB miss/reload, we
introduce monotonic hugepage [direct mapped] split event counts since
system state: SYSTEM_RUNNING to be displayed as part of /proc/vmstat in
x86 servers

The lifetime split event information will be displayed at the bottom of
/proc/vmstat
  ....
  swap_ra 0
  swap_ra_hit 0
  direct_map_level2_splits 94
  direct_map_level3_splits 4
  nr_unstable 0
  ....

One of the many lasting sources of direct hugepage splits is kernel
tracing (kprobes, tracepoints).

Note that the kernel's code segment [512 MB] points to the same physical
addresses that have been already mapped in the kernel's direct mapping
range.

Source : Documentation/x86/x86_64/mm.rst

When we enable kernel tracing, the kernel has to modify
attributes/permissions of the text segment hugepages that are direct
mapped causing them to split.

Kernel's direct mapped hugepages do not coalesce back after split and
remain in place for the remainder of the lifetime.

An instance of direct page splits when we turn on dynamic kernel tracing
....
cat /proc/vmstat | grep -i direct_map_level
direct_map_level2_splits 784
direct_map_level3_splits 12
bpftrace -e 'tracepoint:raw_syscalls:sys_enter { @ [pid, comm] =
count(); }'
cat /proc/vmstat | grep -i
direct_map_level
direct_map_level2_splits 789
direct_map_level3_splits 12
....

Link: https://lkml.kernel.org/r/20210218235744.1040634-1-saravanand@fb.com
Signed-off-by: Saravanan D <saravanand@fb.com>
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-05-05 11:27:25 -07:00
..
boot - turn the stack canary into a normal __percpu variable on 32-bit which 2021-04-27 17:45:09 -07:00
configs module: remove EXPORT_UNUSED_SYMBOL* 2021-02-08 12:28:07 +01:00
crypto Objtool updates in this cycle were: 2021-04-28 12:53:24 -07:00
entry \n 2021-04-29 10:51:29 -07:00
events Perf events changes in this cycle were: 2021-04-28 13:03:44 -07:00
hyperv The x86 MM changes in this cycle were: 2021-04-29 11:41:43 -07:00
ia32 x86/ia32_signal: Propagate __user annotation properly 2020-12-11 19:44:31 +01:00
include mm/vmalloc: provide fallback arch huge vmap support functions 2021-04-30 11:20:40 -07:00
kernel Revert "mremap: don't allow MREMAP_DONTUNMAP on special_mappings and aio" 2021-04-30 11:20:39 -07:00
kvm Merge branch 'for-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup 2021-04-27 18:47:42 -07:00
lib - turn the stack canary into a normal __percpu variable on 32-bit which 2021-04-27 17:45:09 -07:00
math-emu x86/fpu/math-emu: Fix function cast warning 2021-03-23 00:08:02 +01:00
mm x86/mm: track linear mapping split events 2021-05-05 11:27:25 -07:00
net Networking changes for 5.13. 2021-04-29 11:57:23 -07:00
pci x86: Fix various typos in comments 2021-03-18 15:31:53 +01:00
platform - turn the stack canary into a normal __percpu variable on 32-bit which 2021-04-27 17:45:09 -07:00
power - turn the stack canary into a normal __percpu variable on 32-bit which 2021-04-27 17:45:09 -07:00
purgatory crypto: sha - split sha.h into sha1.h and sha2.h 2020-11-20 14:45:33 +11:00
ras
realmode x86: Fix various typos in comments, take #2 2021-03-21 23:50:28 +01:00
tools x86/tools/insn_sanity: Convert to insn_decode() 2021-03-15 12:21:11 +01:00
um um: remove process stub VMA 2021-02-12 21:37:38 +01:00
video
xen The x86 MM changes in this cycle were: 2021-04-29 11:41:43 -07:00
.gitignore
Kbuild
Kconfig userfaultfd: add minor fault registration mode 2021-05-05 11:27:22 -07:00
Kconfig.assembler
Kconfig.cpu
Kconfig.debug x86, libnvdimm/test: Remove COPY_MC_TEST 2020-10-26 18:08:35 +01:00
Makefile Kbuild updates for v5.13 2021-04-29 14:24:39 -07:00
Makefile.um
Makefile_32.cpu