参照元†
- FIXME: これは何?
- この関数は buddy system にある解放されているページのオーダーを返す。
この関数と並列で割当やゴミ回収が実行されるのを防ぐため、呼び出し側で
ゾーンのロック(page_zone(page)->lock)を確保してから、この関数を呼ばなければならない。
もし呼び出し側でロックを確保しない場合、並列にページが確保されないことやマージされないことを
呼び出し側で保証しなければならない。あるいは、無効な値を正しく扱い、後述の page_order_unsafe() を使う必要がある。
返り値†
- unsigned int
- (おそらく)解放されている連続したページ数のオーダー
- 1ページなら 0、2〜3 ページなら 1、4〜7 ページなら 2、…
/*
* This function returns the order of a free page in the buddy system. In
* general, page_zone(page)->lock must be held by the caller to prevent the
* page from being allocated in parallel and returning garbage as the order.
* If a caller does not hold page_zone(page)->lock, it must guarantee that the
* page cannot be allocated or merged in parallel. Alternatively, it must
* handle invalid values gracefully, and use page_order_unsafe() below.
*/
static inline unsigned int page_order(struct page *page)
{
/* PageBuddy() must be checked by the caller */
return page_private(page);
- プライベートデータを得る。
- FIXME: プライベートデータは場合によって意味が違う、誰がどこで更新している??
- プライベートデータは複数の場所で更新しているが、
set_page_order() 経由で更新しているのは下記の 2関数だけ。
}
コメント†