summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorGregory Price (Meta) <gourry@gourry.net>2026-10-31 22:13:40 -0400
committerVlastimil Babka (SUSE) <vbabka@kernel.org>2026-11-05 10:58:52 +0100
commit9b0c84dca162ff4b3804b84595873cf3e41cfe43 (patch)
tree4223a263082d9b01aa190be0a78a1b0b48ebb929 /include/linux
parent4cc1bcdf2e4ebcd319005ce2ea132489f6155139 (diff)
mm/mmzone: remove zonelist_node_idx()
zonelist_node_idx() looks like it returns a field of the zoneref, as zonelist_zone_idx() does, but it loads the zone from the slot again. Memory hotplug rewrites zonelists in place, so a caller that has already checked the slot can get a different zone, or the NULL terminator, from that second load. __next_zones_zonelist() and mempolicy_slab_node() had this bug. Remove the helper and open-code it in its two remaining callers, neither of which can race with a rebuild. local_memory_node() runs either inside __build_all_zonelists() or during CPU bring-up, which holds cpu_hotplug_lock for write and so excludes mem_hotplug_begin(). The lookup in mpol_misplaced() is unreachable: it needs a policy with MPOL_F_MOF but not MPOL_F_MORON, and nothing sets one without the other. Signed-off-by: Gregory Price (Meta) <gourry@gourry.net> Link: https://patch.msgid.link/20261101021340.2251928-13-gourry@gourry.net Reviewed-by: Zi Yan <ziy@nvidia.com> Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mmzone.h6
1 files changed, 0 insertions, 6 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 4bc2318ac37f..72ffb2959c4f 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -1439,7 +1439,6 @@ struct zoneref {
*
* zonelist_zone() - Return the struct zone * for an entry in _zonerefs
* zonelist_zone_idx() - Return the index of the zone for an entry
- * zonelist_node_idx() - Return the index of the node for an entry
*/
struct zonelist {
struct zoneref _zonerefs[MAX_ZONES_PER_ZONELIST + 1];
@@ -1864,11 +1863,6 @@ static inline int zonelist_zone_idx(const struct zoneref *zoneref)
return zoneref->zone_idx;
}
-static inline int zonelist_node_idx(const struct zoneref *zoneref)
-{
- return zone_to_nid(zoneref->zone);
-}
-
struct zoneref *__next_zones_zonelist(struct zoneref *z,
enum zone_type highest_zoneidx,
const nodemask_t *nodes);