#author("2025-09-10T14:18:19+09:00","default:guest","guest")
#author("2025-09-10T14:25:23+09:00","default:guest","guest")
*参照元 [#v709ce7e]
#backlinks

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

-FIXME: これは何?
--zone_page_state()とほぼ一緒だが、各CPUの誤差を考慮したより正確な値を返す。
--[[linux-5.15/zone_page_state()]]


**引数 [#p06a4772]
-struct zone *zone
--
--[[linux-5.15/zone]]
-enum zone_stat_item item
--
--[[linux-5.15/zone_stat_item]]


**返り値 [#n778e40f]
-unsigned long
--


**参考 [#i6b80dd0]

-
--[[linux-5.15/zone_page_state()]]


*実装 [#l2b30f1c]

 /*
  * More accurate version that also considers the currently pending
  * deltas. For that we need to loop over all cpus to find the current
  * deltas. There is no synchronization so the result cannot be
  * exactly accurate either.
  */
 static inline unsigned long zone_page_state_snapshot(struct zone *zone,
 					enum zone_stat_item item)
 {
 	long x = atomic_long_read(&zone->vm_stat[item]);
 
 #ifdef CONFIG_SMP
 	int cpu;
 	for_each_online_cpu(cpu)
 		x += per_cpu_ptr(zone->per_cpu_zonestats, cpu)->vm_stat_diff[item];
 
 	if (x < 0)
 		x = 0;
 #endif
 	return x;
 }

-vm_statにはメモリの統計情報が記録されている。
--[[linux-5.15/atomic_long_read()]]
--[[linux-5.15/for_each_online_cpu()]]
--[[linux-5.15/per_cpu_ptr()]]


*コメント [#qa797028]

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