summaryrefslogtreecommitdiffstats
path: root/mm/vmalloc.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2024-07-06 20:44:41 +0200
committerAndrew Morton <akpm@linux-foundation.org>2024-07-06 20:44:41 +0200
commit8ef6fd0e9ea83a792ba53882ddc6e0d38ce0d636 (patch)
treeb119eaeb76c7afb8672d30078ab7061cb7be67fb /mm/vmalloc.c
parentdocs: mm: add enable_soft_offline sysctl (diff)
parentMAINTAINERS: mailmap: update Lorenzo Stoakes's email address (diff)
downloadlinux-8ef6fd0e9ea83a792ba53882ddc6e0d38ce0d636.tar.xz
linux-8ef6fd0e9ea83a792ba53882ddc6e0d38ce0d636.zip
Merge branch 'mm-hotfixes-stable' into mm-stable to pick up "mm: fix
crashes from deferred split racing folio migration", needed by "mm: migrate: split folio_migrate_mapping()".
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r--mm/vmalloc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index b4c42da9f390..6b783baf12a1 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2544,7 +2544,15 @@ static DEFINE_PER_CPU(struct vmap_block_queue, vmap_block_queue);
static struct xarray *
addr_to_vb_xa(unsigned long addr)
{
- int index = (addr / VMAP_BLOCK_SIZE) % num_possible_cpus();
+ int index = (addr / VMAP_BLOCK_SIZE) % nr_cpu_ids;
+
+ /*
+ * Please note, nr_cpu_ids points on a highest set
+ * possible bit, i.e. we never invoke cpumask_next()
+ * if an index points on it which is nr_cpu_ids - 1.
+ */
+ if (!cpu_possible(index))
+ index = cpumask_next(index, cpu_possible_mask);
return &per_cpu(vmap_block_queue, index).vmap_blocks;
}