Page Faults in Multi-Threaded Programs

From: Michal Ostrowski (mostrows@styx.uwaterloo.ca)
Date: Wed May 24 2000 - 13:08:29 EST


I was running a multi-threaded program recently (kernel threads) and
noticed that all page-faults were being handled sequentially (even
though they were occurring in different threads). Looking through the
source, it appears as though this is due to the fact that when a
page-fault occurs, the thread which generated the fault holds the
mm->mmap_sem semaphore until the fault is fully resolved.

I've tried releasing the semaphore on entry into filemap_nopage and
re-acquiring it afterwards and with this setup I've observed concurrent
page-faults being handled successfully. However, this is a very crude
hack and analysis and I was wondering if there are subtle gotcha's out
there that anyone may be aware of.

Is it sufficient to release and re-acquire the semaphore around blocking
operations? If so, is it necessary to grab some finer-grained locks
instead (perhaps locking vm_area_struct's, or page structs)? Or is
this hopeless until some major restructuring of the mm code occurs?

Michal Ostrowski
mostrows@styx.uwaterloo.ca

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:12 EST