mm/execmem: keep the ROX cache huge-page only
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | mm/execmem: handle potential allocation errors in the maple treemm/ | +22 | 0 replies | |
| 2/2 | mm/execmem: make sure ROX cache always contains multiples of PMD_SIZEinclude/ mm/ mm/ | +62 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 7.3.y 0/2] mm/execmem: keep the ROX cache huge-page only
Hi,
Please consider these two mainline commits for 7.3.y:
d80773cedde2 ("mm/execmem: handle potential allocation errors in the maple tree") 569db54d8b7a ("mm/execmem: make sure ROX cache always contains multiples of PMD_SIZE")
They complete the series whose first patch, 52d95a55a011 ("mm/execmem:
free ROX cache chunks only when they span an entire vm area"), is already in 7.3.4 as 8c60564f03e0. The same two commits are posted separately for 6.18.y, and this version keeps 7.3.y covered for that request.
On x86 systems with 384 CPUs, udev coldplug runs several hundred concurrent init_module() calls for the same modules (kvm, kvm_intel, irqbypass, x86_pkg_temp_thermal). On a ROX cache miss, execmem_cache_populate_alloc() reserves a 2 MiB area before it takes the cache mutex, so these reservations briefly exhaust the module address range. Each failed attempt prints "execmem: unable to allocate memory", although the exact-size retry succeeds and every module loads. The exact-size areas then stay in the cache and are never freed.
With 569db54d8b7a, the cache refill only accepts a huge-page backed, PMD-sized area and fails quietly otherwise. The allocation then falls back to an exact-size ROX area outside the cache. d80773cedde2 is a prerequisite.
7.3.y does not have 4c4b2ed5b783 ("mm/execmem: use VM_FLUSH_RESET_PERMS for ROX cache allocations"), so both patches keep the existing execmem_set_direct_map_valid() handling for cache chunks. The uncached fallback is freed with plain vfree(), so it uses VM_FLUSH_RESET_PERMS like the non-ROX path. Each patch documents the change in a [ 7.3: ] note. Mike, if you would rather have 4c4b2ed5b783 backported as well, I can send that version instead.
569db54d8b7a is above the usual 100-line limit. A large part of it moves the ROX setup into a helper that the cache refill and the fallback share.
Both patches apply cleanly to v7.3.5, and mm/execmem.o and mm/vmalloc.o build with W=1 on x86_64. The code changes are the same as in the 6.18.y version, which was tested on c8i.metal-96xl: 20 and 29 warnings without the patches, none with them, and no failed module loads in either case. I have not run the 7.3.y version on hardware.
Gyokhan
Mike Rapoport (Microsoft) (2):
mm/execmem: handle potential allocation errors in the maple tree mm/execmem: make sure ROX cache always contains multiples of PMD_SIZE
include/linux/vmalloc.h | 1 + mm/execmem.c | 109 +++++++++++++++++++++++++--------------- mm/vmalloc.c | 15 +++++- 3 files changed, 84 insertions(+), 41 deletions(-)
base-commit: 988117cc1bb17338c586a4e21ade88b5397eac33
Signature · 1 line
2.50.1