linux-next/arch/s390/mm
Gerald Schaefer f934f6be76 s390/mm: Introduce region-third and segment table swap entries
Introduce region-third (PUD) and segment table (PMD) swap entries, and
make hugetlbfs RSTE <-> PTE conversion code aware of them, so that they
can be used for hugetlbfs PTE_MARKER entries. Future work could also
build on this to enable THP_SWAP and THP_MIGRATION for s390.

Similar to PTE swap entries, bits 0-51 can be used to store the swap
offset, but bits 57-61 cannot be used for swap type because that overlaps
with the INVALID and TABLE TYPE bits. PMD/PUD swap entries must be invalid,
and have a correct table type so that pud_folded() check still works.

Bits 53-57 can be used for swap type, but those include the PROTECT bit.
So unlike swap PTEs, the PROTECT bit cannot be used to mark the swap entry.
Use the "Common-Segment/Region" bit 59 instead for that.

Also remove the !MACHINE_HAS_NX check in __set_huge_pte_at(). Otherwise,
that would clear the _SEGMENT_ENTRY_NOEXEC bit also for swap entries, where
it is used for encoding the swap type. The architecture only requires this
bit to be 0 for PTEs, with !MACHINE_HAS_NX, not for segment or region-third
entries. And the check is also redundant, because after __pte_to_rste()
conversion, for non-swap PTEs it would only be set if it was already set in
the PTE, which should never be the case for !MACHINE_HAS_NX.

This is a prerequisite for hugetlbfs PTE_MARKER support on s390, which
is needed to fix a regression introduced with commit 8a13897fb0
("mm: userfaultfd: support UFFDIO_POISON for hugetlbfs"). That commit
depends on the availability of swap entries for hugetlbfs, which were
not available for s390 so far.

Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
2024-11-27 12:55:21 +01:00
..
cmm.c s390/mm: Add cond_resched() to cmm_alloc/free_pages() 2024-09-05 15:17:23 +02:00
dump_pagetables.c s390 updates for 6.12 merge window 2024-09-21 09:02:54 -07:00
extable.c s390: add support for DCACHE_WORD_ACCESS 2023-10-16 13:04:09 +02:00
extmem.c s390/extmem: Convert to use flag output macros 2024-11-13 14:31:33 +01:00
fault.c s390/mm: Cleanup fault error handling 2024-10-29 11:49:19 +01:00
gmap.c s390/mm: Introduce region-third and segment table entry present bits 2024-11-27 12:55:21 +01:00
hugetlbpage.c s390/mm: Introduce region-third and segment table swap entries 2024-11-27 12:55:21 +01:00
init.c memblock: updates for 6.12-rc1 2024-09-25 11:35:19 -07:00
maccess.c s390/uaccess: Make s390_kernel_write() usable for decompressor 2024-07-23 16:02:31 +02:00
Makefile s390/mm: provide simple ARCH_HAS_DEBUG_VIRTUAL support 2024-03-13 09:23:49 +01:00
mmap.c mm: make arch_get_unmapped_area() take vm_flags by default 2024-09-09 16:39:13 -07:00
page-states.c s390/cmma: rework no-dat handling 2023-11-05 22:34:58 +01:00
pageattr.c s390/pageattr: Convert to use flag output macros 2024-11-13 14:31:31 +01:00
pfault.c s390/pfault: use consistent comment style 2023-07-29 14:57:18 +02:00
pgalloc.c s390 updates for 6.11 merge window 2024-07-18 15:41:45 -07:00
pgtable.c s390: Fix various typos 2024-10-25 16:03:23 +02:00
physaddr.c s390/mm: provide simple ARCH_HAS_DEBUG_VIRTUAL support 2024-03-13 09:23:49 +01:00
vmem.c s390: Keep inittext section writable 2024-07-31 16:30:20 +02:00