diff options
author | Neal H. Walfield <neal@gnu.org> | 2008-11-12 12:43:44 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@gnu.org> | 2008-11-12 12:43:44 +0100 |
commit | e8d5499c2e6cec827a464f10c21b29b6fc241ec4 (patch) | |
tree | c71d9d9924a47bf4edeb0072fda027a145368f26 /libhurd-mm/anonymous.c | |
parent | bc8e6dd4eff29a74453bfa3e1c1346946c8239e1 (diff) |
Make the anonymous pager's fault handler and madvise reentrant.
2008-11-12 Neal H. Walfield <neal@gnu.org>
* anonymous.h (struct anonymous_pager): Improve documentation for
the fill_lock field.
* anonymous.c (fault): Drop ANON->LOCK before calling the user's
fill function.
(destroy): Before destroying ANON, take ANON->FILL_LOCK.
* madvise.c (madvise): Refactor to not hold map lock when calling
MAP->PAGER->ADVISE.
Diffstat (limited to 'libhurd-mm/anonymous.c')
-rw-r--r-- | libhurd-mm/anonymous.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libhurd-mm/anonymous.c b/libhurd-mm/anonymous.c index 2185613..4461360 100644 --- a/libhurd-mm/anonymous.c +++ b/libhurd-mm/anonymous.c @@ -292,6 +292,8 @@ fault (struct pager *pager, uintptr_t offset, int count, bool read_only, } } + ss_mutex_unlock (&anon->lock); + r = true; if (anon->fill) @@ -328,8 +330,6 @@ fault (struct pager *pager, uintptr_t offset, int count, bool read_only, } } - ss_mutex_unlock (&anon->lock); - profile_region_end (); debug (5, "Fault at %x resolved", fault_addr); @@ -436,6 +436,9 @@ destroy (struct pager *pager) struct anonymous_pager *anon = (struct anonymous_pager *) pager; + /* Wait any fill function returns. */ + ss_mutex_lock (&anon->fill_lock); + if (anon->staging_area) /* Free the staging area. */ { |