物理ページ管理
Rev.26を表示中。最新版はこちら。
作成中vm_page_t
物理ページ管理用の構造体
表1 vm_page_tのフィールド(一部)
| 項目 | 内容 |
|---|---|
| inactive | Inactiveページである。 |
| active | Activeページである。 |
| pageout_queue | PageOutQueueにつながれている。 vm_pageout_queue_internal,externel |
| laundry | PageOutQueueにつまれるときにTRUEになる。 Pageout処理中であることを示す? pageout_queueに似ているが、pageout_queueはIOスレッドがキューからページを取り出すとFALSEになるが、laundryはTRUEのまま。PagerがPageout処理中であることを判定 |
| free | Freeページ。Freeキューにつながれている。 |
| reference | PageTableEntryのAccessed bit相当。 |
| pageout | Pageoutするためにwired,busy状態である。 |
| wanted | このページを待っているスレッドが存在する。 |
| tabled | vm_objectのmemqにつながれている時、TRUE |
| fictitious | 物理ページが存在しない |
| absent | データが要求されたがページが存在しない場合TRUE。 vm_object_upl_request()でPageinのUPLを作る際、VM Objectにページがなかった場合、セットされている。 |
| dirty | PageTableEntryのDirty bit相当。 |
物理ページはwired,active,inactive,freeに分類される。
表2 ページの種類
(*1)
inactiveキューへの移動時にpmapからの削除は行っていないみたい。実際にはページアウトされてUPLをcommitするまでpmapから消されない?
| 種別 | 説明 |
|---|---|
| wired | Pageoutできないページ。 Wiredページはどのキューにも積まれていない。 |
| active | 少なくとも1つのpmapに属しているページ。 |
| inactive | どのpmapにも属していないページ。Pageout時はinactiveページが選ばれる。 vm_page_scan()でinactiveページ数が少なくなると、activeキューからinactiveキューに移動させている(*1)。 |
| free | 未使用ページ。いわゆる空きメモリ。 |
参考 osfmk/vm/vm_page.h
/*
* Each pageable resident page falls into one of three lists:
*
* free
* Available for allocation now.
* inactive
* Not referenced in any map, but still has an
* object/offset-page mapping, and may be dirty.
* This is the list of pages that should be
* paged out next.
* active
* A list of pages which have been placed in
* at least one physical map. This list is
* ordered, in LRU-like fashion.
*/
[ページ管理用キュー]
vm_page_queue_free
freeページがつながれる。
vm_page_queue_activeactiveページがつながれる。
activeページは mem->active == TRUE。
vm_page_queue_inactive
inactiveページがつながれる。
inactiveページは(mem->inactive == TRUE && mem->zero_fill == FALSE)
inactiveページは(mem->inactive == TRUE && mem->zero_fill == FALSE)
vm_page_queue_zf
inactiveページのうちZero Fillページをつなぐ。
Zero Fillページは(mem->inactive == TRUE && mem->zero_fill == TRUE)
Zero Fillページは(mem->inactive == TRUE && mem->zero_fill == TRUE)
[関連関数]
vm_page_grab()
空きページをFreeList(vm_page_queue_free)から取得する。
