Pergunta

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.

Foi útil?

Solução

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).

Outras dicas

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. */

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top