I am asking about Data structures used in the following:

I am wondering how linux tracks all the physical pages. I am not worried about how it keeps the vm_area_struct. What is the data structure used to store all of them?

And how it looks up a particular physical page when it is given a virtual address?

Radix tree? red-black tree? hash table? what?

Thanks.

有帮助吗?

解决方案

The kernel keeps an array of struct page structures, one for each physical page.

A virtual address is looked up by walking the page table structure, which is a tree (defined by the hardware).

其他提示

From : include/linux/mm_types.h

/* * Each physical page in the system has a struct page associated with it to keep track of whatever it is we are using the page for at the moment. Note that we have no way to track which tasks are using a page, though if it is a pagecache page, rmap structures can tell us who is mapping it. */

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top