Skip to contentSkip to conversation

Doubt in pagefault handler..!

DISCUSSION John Navil Joseph 2 participants 2 messages Feb 4, 2003 – Feb 5, 2003 Memory management

lore
Share & tools
lore
#0 lore raw

Hi,

I am trying to implement Distributed Shared Memory for LInux. I am planning to
implement this in the same lines as of SystemV IPC shared Memory. Well in this case the processes involved in the DSM may be present in any computer across the network.

*) on the occurence of a pagefault (in the VMA correspnding to the DSM) it may be necessary for me to fetch the physical pages remotely across the network. So my page fault handler may need to prempt the faulting process till the page is fetched from across the network. I am not sure how this is to be done.

I assume that i can deal with the page fault handler just as any other interrupt handler and proceed to do the following.

1) add the current process to a wait queue
2) invoke schedule() from the page fault handler
3) wake up the process after the transfer has been completed.

now my question is

is it possible to invoke schedule() from page fault handler. ?

I know that the hardware restarts the faulting instruction after handling the interrupt.. so if i invoke schedule() from the pf handler.. then how will the interupt return.. and how does hardware handle this situation ?

i tried to trace pagefault handler all the way down to where the acutal IO takes palce incase of the transfer of page from swap to memory..But i never saw schedule() anywhere. But i know that process sleeps on page I/O .. then how and where does this sleeping takes place.?

please forgive me as my knowledge about the linux MM is inconsistent. I hope that my questions are clear.

TIA
john

#1 lore raw
Quoted 4 lines · John Navil Joseph

1) add the current process to a wait queue
2) invoke schedule() from the page fault handler
3) wake up the process after the transfer has been completed.

You probably don't need to do all that by hand - you should be calling non-blocking functions in the network layer, and waking the faulting process up on completion of network I/O (based on interrupt-time networking callbacks).

Looking at the NFS and SMB client code may help.

Quoted 4 lines

i tried to trace pagefault handler all the way down to where the acutal IO takes palce incase of the transfer of page from swap to memory..But i never saw schedule() anywhere. But i know that process sleeps on page I/O .. then how and where does this sleeping takes place.?

The faulting process will sleep in wait_on_page() or lock_page(). See filemap_nopage(), around the page_not_uptodate label.

The filesystem's responsibility is to run unlock_page() against the page once its contents have been filled in from the backing medium (disk, network, etc). it will typically do this from interrupt context. The unlock_page() will wake up the faulting process.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/