linux kernel vfree() how to synchronize master kernel page table and process's page table?

554 views Asked by At

I know how vmalloc() does。 When a process(in kernel space) want to access the memory that belongs to vmalloc(),a page fault happens and does the synchronization。

But when it invokes the vfree(), how the process update its page table to sync with the master kernel page table? Or I have some understandings with it.

Thanks.

1

There are 1 answers

3
Pradeep Goswami On

your understanding of memory allocation is seems to be incorrect. No memory belongs to vmalloc. A fixed virtual address (of kernel space) is assigned to vmalloc at boot up time. Later when vmalloc is called then virtual addresses are picked from fix allocated range and physical memory pages are allocated from buddy system.

Virtual addresses and physical pages are mapped one to one.

when vfree() is called, the virtual address range is freed again , so does the physical pages are return to buddy system.

Hope this correct your understanding.

I suggest you go through some online tutorial about kernel memory as also reading them now.