x86/mm changes for v6.13:

- x86/mm/tlb: Put cpumask_test_cpu() check in switch_mm_irqs_off()
                under CONFIG_DEBUG_VM, to micro-optimize the context-switching
 	       code (Rik van Riel)
 
  - x86/mm/doc: Add missing details in virtual memory layout (Kirill A. Shutemov)
 
 Signed-off-by: Ingo Molnar <mingo@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmc7gpURHG1pbmdvQGtl
 cm5lbC5vcmcACgkQEnMQ0APhK1iNSg//asJkGGkRhGpXikUC/8wrCZymu+P8POtH
 BUl6Ksj3I7r7qdd/jiWcbiWE9nCjVPeKAuO5EnR/lOjMzVnZKA7U8MUCgwRdDVLC
 u8QCDDZGTnlkRYmBYr6gO14Z+XS/ZT/uGVmDrGsEdnqdYy5kGta7yvKYL7MzCcgP
 4yZLNokFFofwEyDjMullBDN9ytK2PzjWgdWLHsyXXxdAT68c9kH/xDDrjk145g5V
 5p/xSz2v3CUeS+0dbrZ5MHS6r9YwTdYTqXE7Oftte0FLrSFxRNhoi7mA2p0Uoa+I
 KVFq2bK4Q5lx/vE3HSagOVmgU8BU1jJhd/bBei2SXVbEMhfPIPFtC4y1aSrWq39o
 N2tQZwK3xpUZTmtkp1Uu+5XVJZZieSbLfOe6xfP13puiEHVWIJI+NhMZAEP18k1N
 dza7AoldN61/1Tbjoz2fjMPIyEciVaUSycgL4DO3tFmrmnooUwYj0924mVU2+ksi
 qRePZAWZNJq6KUnZ5XOmZ4pSQVEikmFhlSvXr+k5iFYCHqsQ8OkKB4+AKynb9E6Q
 zPnQJsIAHRnRmBavyB4sOcFhT5AmRyDAV0xxbLYYzMCsebmcTFAdeR9i/8cy53kT
 W/jrcgteiQDG2DVjkWG7do6Ht3DqXoQbyB3DeaoQKjL7Zga75yuxGFUzEcdldF/0
 Wx11Lev2cDI=
 =J3AD
 -----END PGP SIGNATURE-----

Merge tag 'x86-mm-2024-11-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 mm updates from Ingo Molnar:

 - Put cpumask_test_cpu() check in switch_mm_irqs_off() under
   CONFIG_DEBUG_VM, to micro-optimize the context-switching code (Rik
   van Riel)

 - Add missing details in virtual memory layout (Kirill A. Shutemov)

* tag 'x86-mm-2024-11-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/mm/tlb: Put cpumask_test_cpu() check in switch_mm_irqs_off() under CONFIG_DEBUG_VM
  x86/mm/doc: Add missing details in virtual memory layout
This commit is contained in:
Linus Torvalds 2024-11-19 14:48:31 -08:00
commit a5c93bfec0
2 changed files with 30 additions and 7 deletions

View File

@ -29,15 +29,27 @@ Complete virtual memory map with 4-level page tables
Start addr | Offset | End addr | Size | VM area description
========================================================================================================================
| | | |
0000000000000000 | 0 | 00007fffffffffff | 128 TB | user-space virtual memory, different per mm
0000000000000000 | 0 | 00007fffffffefff | ~128 TB | user-space virtual memory, different per mm
00007ffffffff000 | ~128 TB | 00007fffffffffff | 4 kB | ... guard hole
__________________|____________|__________________|_________|___________________________________________________________
| | | |
0000800000000000 | +128 TB | ffff7fffffffffff | ~16M TB | ... huge, almost 64 bits wide hole of non-canonical
| | | | virtual memory addresses up to the -128 TB
0000800000000000 | +128 TB | 7fffffffffffffff | ~8 EB | ... huge, almost 63 bits wide hole of non-canonical
| | | | virtual memory addresses up to the -8 EB
| | | | starting offset of kernel mappings.
| | | |
| | | | LAM relaxes canonicallity check allowing to create aliases
| | | | for userspace memory here.
__________________|____________|__________________|_________|___________________________________________________________
|
| Kernel-space virtual memory, shared between all processes:
__________________|____________|__________________|_________|___________________________________________________________
| | | |
8000000000000000 | -8 EB | ffff7fffffffffff | ~8 EB | ... huge, almost 63 bits wide hole of non-canonical
| | | | virtual memory addresses up to the -128 TB
| | | | starting offset of kernel mappings.
| | | |
| | | | LAM_SUP relaxes canonicallity check allowing to create
| | | | aliases for kernel memory here.
____________________________________________________________|___________________________________________________________
| | | |
ffff800000000000 | -128 TB | ffff87ffffffffff | 8 TB | ... guard hole, also reserved for hypervisor
@ -88,15 +100,26 @@ Complete virtual memory map with 5-level page tables
Start addr | Offset | End addr | Size | VM area description
========================================================================================================================
| | | |
0000000000000000 | 0 | 00ffffffffffffff | 64 PB | user-space virtual memory, different per mm
0000000000000000 | 0 | 00fffffffffff000 | ~64 PB | user-space virtual memory, different per mm
00fffffffffff000 | ~64 PB | 00ffffffffffffff | 4 kB | ... guard hole
__________________|____________|__________________|_________|___________________________________________________________
| | | |
0100000000000000 | +64 PB | feffffffffffffff | ~16K PB | ... huge, still almost 64 bits wide hole of non-canonical
| | | | virtual memory addresses up to the -64 PB
0100000000000000 | +64 PB | 7fffffffffffffff | ~8 EB | ... huge, almost 63 bits wide hole of non-canonical
| | | | virtual memory addresses up to the -8EB TB
| | | | starting offset of kernel mappings.
| | | |
| | | | LAM relaxes canonicallity check allowing to create aliases
| | | | for userspace memory here.
__________________|____________|__________________|_________|___________________________________________________________
|
| Kernel-space virtual memory, shared between all processes:
____________________________________________________________|___________________________________________________________
8000000000000000 | -8 EB | feffffffffffffff | ~8 EB | ... huge, almost 63 bits wide hole of non-canonical
| | | | virtual memory addresses up to the -64 PB
| | | | starting offset of kernel mappings.
| | | |
| | | | LAM_SUP relaxes canonicallity check allowing to create
| | | | aliases for kernel memory here.
____________________________________________________________|___________________________________________________________
| | | |
ff00000000000000 | -64 PB | ff0fffffffffffff | 4 PB | ... guard hole, also reserved for hypervisor

View File

@ -568,7 +568,7 @@ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next,
* mm_cpumask. The TLB shootdown code can figure out from
* cpu_tlbstate_shared.is_lazy whether or not to send an IPI.
*/
if (WARN_ON_ONCE(prev != &init_mm &&
if (IS_ENABLED(CONFIG_DEBUG_VM) && WARN_ON_ONCE(prev != &init_mm &&
!cpumask_test_cpu(cpu, mm_cpumask(next))))
cpumask_set_cpu(cpu, mm_cpumask(next));