diff options
author | Andrew Morton | 2024-07-06 11:44:41 -0700 |
---|---|---|
committer | Andrew Morton | 2024-07-06 11:44:41 -0700 |
commit | 8ef6fd0e9ea83a792ba53882ddc6e0d38ce0d636 (patch) | |
tree | b119eaeb76c7afb8672d30078ab7061cb7be67fb /mm/vmalloc.c | |
parent | 44195d1eba826a8af0afbcfa69ab4cc26f6ead7f (diff) | |
parent | 1e3d28fe03cdac1f58402e4da1e1e59fb70d145f (diff) |
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.c | 10 |
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; } |