first_zones_zonelist(9)
β¨ first_zones_zonelist(9) β¨
okay bestie, welcome to the Kernel API Manual entry for first_zones_zonelist β and yes it's a (9) page, we're in the big leagues now π
πΈ NAME πΈ
first_zones_zonelist β literally returns the first zone at or below highest_zoneidx within the allowed nodemask in a zonelist π¦
π SYNOPSIS π
struct zoneref * first_zones_zonelist (struct zonelist *zonelist , enum
zone_type highest_zoneidx , const nodemask_t *nodes );
that's the whole vibe, no cap β¨
π ARGUMENTS π
zonelistβ the zonelist you're searching through to find a suitable zone πhighest_zoneidxβ the zone index of the highest zone to return, like the ceiling of your search πnodesβ an optional nodemask to filter the zonelist with (optional!! so you can pass nothing and it's still chill) π
π§ DESCRIPTION π§
okay so here's the tea π β this function returns the first zone at or below a given zone index that's also within the allowed nodemask.
the zoneref you get back is a cursor, iykyk π β you can use it to iterate the zonelist with next_zones_zonelist by advancing it by one before calling. so it's not just a one-and-done answer, it's your starting point for the whole journey π«Ά
and now the serious part, bestie, don't skip this π β when no eligible zone is found,zoneref->zoneisNULL(butzonerefitself is neverNULL, she's always there, just maybe empty inside π). this can happen either genuinely, or due to a concurrent nodemask update due to cpuset modification. yes, race conditions are real, stay safe out there π
β RETURN β
a zoneref pointer for the first suitable zone found π₯
π¦ SEE ALSO π¦
kernel file ./include/linux/mmzone.h is doing a whole lot, and while you're in there check out these iconic siblings:
is_highmem(9)for_each_online_pgdat(9)for_each_zone(9)next_zones_zonelist(9)for_each_zone_zonelist_nodemask(9)for_each_zone_zonelist(9)pfn_valid(9)
periodt π
and that's the whole page, bestie, you ate that πβ¨ this one came from ./include/linux, dated October 2026, and it's first_zones_zonelist(9) β go forth and find your first suitable zone, ily πππ§
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms