#author("2025-10-27T11:17:53+09:00","default:guest","guest")
#author("2025-10-27T11:25:23+09:00","default:guest","guest")
*参照元 [#r3ea82ba]
#backlinks

*説明 [#v2861cda]
-パス: [[linux-5.15/include/linux/mmzone.h]]

-FIXME: これは何?
--説明


**引数 [#ve5ed204]
-struct zoneref *z
--
--現在のzonerefではなく、次のzonerefを指定する。もしhighest_indexを越えたzonerefを参照していたら、次のnodeのzonerefを返す。
--next_zones_zonelist(++z, ...)のように使われる。
--[[linux-5.15/zoneref]]
-enum zone_type highest_zoneidx
--
--[[linux-5.15/zone_type]]
-nodemask_t *nodes
--
--[[linux-5.15/nodemask_t]]


**返り値 [#y40595ba]
-struct zoneref *
--
--[[linux-5.15/zoneref]]


**参考 [#e17646b2]


*実装 [#pab6e07e]
 /**
  * next_zones_zonelist - Returns the next zone at or below highest_zoneidx within the allowed nodemask using a cursor within a zonelist as a starting point
  * @z: The cursor used as a starting point for the search
  * @highest_zoneidx: The zone index of the highest zone to return
  * @nodes: An optional nodemask to filter the zonelist with
  *
  * This function returns the next zone at or below a given zone index that is
  * within the allowed nodemask using a cursor as the starting point for the
  * search. The zoneref returned is a cursor that represents the current zone
  * being examined. It should be advanced by one before calling
  * next_zones_zonelist again.
  *
  * Return: the next zone at or below highest_zoneidx within the allowed
  * nodemask using a cursor within a zonelist as a starting point
  */
 static __always_inline struct zoneref *next_zones_zonelist(struct zoneref *z,
 					enum zone_type highest_zoneidx,
 					nodemask_t *nodes)
 {
 	if (likely(!nodes && zonelist_zone_idx(z) <= highest_zoneidx))
 		return z;
 	return __next_zones_zonelist(z, highest_zoneidx, nodes);
 }

-
-highest_zoneidxよりインデックスが小さいなら、zonerefをそのまま返す。
--nextと関数名についているが、この関数内で次のzoneref(z++のようにインクリメントすると得られる)は使わない。呼び出し元が指定するzが、次のzonerefを指している。紛らわしい……。
--[[linux-5.15/likely()]]
-zonelist_zone_idx(z)はz->zone_idxと同じ。
--[[linux-5.15/zonelist_zone_idx()]]
--[[linux-5.15/__next_zones_zonelist()]]


*コメント [#j39a0984]

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS