FROMGIT: mm/vmalloc: Add override for lazy vunmap

Add an interface for arch code to disable lazy vunmap by forcing the
threshold to zero. This might be interesting for debugging/testing in
general, but primarily helps a horrible situation which needs to
guarantee that vmalloc aliases are up-to-date from atomic context,
wherein the only practical solution is to never let them get stale in
the first place.

Bug: 223346425
(cherry picked from commit 2a34c1503b85f49dd472dfd932dfcd16cab8ee8a
 https://git.gitlab.arm.com/linux-arm/linux-rm.git arm64/2454944)
Change-Id: I694523564357b4c43d30c129af1e89fd803824d3
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Beata Michalska <beata.michalska@arm.com>
This commit is contained in:
Robin Murphy
2022-08-19 13:54:25 +01:00
committed by Treehugger Robot
parent 68d4b5fef2
commit abb277d9f1
2 changed files with 7 additions and 0 deletions

View File

@@ -245,4 +245,8 @@ pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms)
int register_vmap_purge_notifier(struct notifier_block *nb);
int unregister_vmap_purge_notifier(struct notifier_block *nb);
#ifndef arch_disable_lazy_vunmap
#define arch_disable_lazy_vunmap false
#endif
#endif /* _LINUX_VMALLOC_H */

View File

@@ -1297,6 +1297,9 @@ static unsigned long lazy_max_pages(void)
{
unsigned int log;
if (arch_disable_lazy_vunmap)
return 0;
log = fls(num_online_cpus());
return log * (32UL * 1024 * 1024 / PAGE_SIZE);