* Doubt in pagefault handler..!
@ 2003-02-04 17:49 John Navil Joseph
2003-02-05 8:48 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: John Navil Joseph @ 2003-02-04 17:49 UTC (permalink / raw)
To: linux-mm
[-- Attachment #1: Type: text/plain, Size: 1613 bytes --]
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
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Doubt in pagefault handler..!
2003-02-04 17:49 Doubt in pagefault handler..! John Navil Joseph
@ 2003-02-05 8:48 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2003-02-05 8:48 UTC (permalink / raw)
To: John Navil Joseph; +Cc: linux-mm
John Navil Joseph <cs99185@nitc.ac.in> wrote:
>
> 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.
> 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 majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-02-05 8:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-04 17:49 Doubt in pagefault handler..! John Navil Joseph
2003-02-05 8:48 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox