memory management - How to serve a page fault in the linux kernel? -
i working on project requires heavy modifications in linux kernel. in 1 of modifications have change way page fault handler works. to intercept page faults specific processes , satisfy them possible getting copying data machine.
as first step, write experimentation code can me understand how linux satisfies page fault , how tells process page fault can not served right , needs retry @ later time.
so, modify handle_mm_fault
in way helps me understand above. this:
int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, unsigned int flags) { /* code */ if(current->pid == my_target_pid) { /* 1. chose randomly between 1 , 2 -> rand_num 2. if rand_num (1) 1 allocate block of memory, write 'x's , give process , return. 3. if rand_num (1) 2 tell process come later , return. */ } /* rest of handle_mm_fault other process here */ }
you can have @ struct vm_operations_struct
. function member 'fault' used deal page fault situation
Comments
Post a Comment