diff options
author | Miles Bader <miles@gnu.org> | 1997-02-12 17:22:47 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1997-02-12 17:22:47 +0000 |
commit | 0840d0299b8511f70bfb3515da2d46bf86180a49 (patch) | |
tree | fa62ec71cec2e8867a7528aca668a121c9562b8d /libpager | |
parent | 624d5518f780fc0e2c9aac9447948c7e8aee2d51 (diff) |
(pager_offer_page):
Rewrite for clarity.
Deal with _pager_pagemap_resize failing.
Diffstat (limited to 'libpager')
-rw-r--r-- | libpager/offer-page.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/libpager/offer-page.c b/libpager/offer-page.c index fe08d3b4..0d62da6a 100644 --- a/libpager/offer-page.c +++ b/libpager/offer-page.c @@ -1,5 +1,5 @@ /* Wrapper for unsolicited memory_object_data_supply - Copyright (C) 1996 Free Software Foundation, Inc. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. Written by Michael I. Bushnell, p/BSG. This file is part of the GNU Hurd. @@ -28,23 +28,25 @@ pager_offer_page (struct pager *p, vm_offset_t offset, vm_address_t buf) { - char *pm_entry; - - try_again: mutex_lock (&p->interlock); - _pager_pagemap_resize (p, offset + vm_page_size); - pm_entry = &p->pagemap[offset / vm_page_size]; - if (*pm_entry & PM_INCORE) + + if (_pager_pagemap_resize (p, offset + vm_page_size)) { - mutex_unlock (&p->interlock); - pager_flush_some (p, offset, vm_page_size, 1); - goto try_again; + char *pm_entry = &p->pagemap[offset / vm_page_size]; + + while (*pm_entry & PM_INCORE) + { + mutex_unlock (&p->interlock); + pager_flush_some (p, offset, vm_page_size, 1); + mutex_lock (&p->interlock); + } + *pm_entry |= PM_INCORE; + + memory_object_data_supply (p->memobjcntl, offset, buf, vm_page_size, 0, + writelock ? VM_PROT_WRITE : VM_PROT_NONE, + precious, MACH_PORT_NULL); } - *pm_entry |= PM_INCORE; - memory_object_data_supply (p->memobjcntl, offset, buf, vm_page_size, 0, - writelock ? VM_PROT_WRITE : VM_PROT_NONE, - precious, MACH_PORT_NULL); mutex_unlock (&p->interlock); } |