summaryrefslogtreecommitdiffstats
path: root/sys/i386/xen/pmap.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2012-09-05 06:02:54 +0000
committeralc <alc@FreeBSD.org>2012-09-05 06:02:54 +0000
commitb1adba8ac63bd3ea7ea749d7238d193761e22776 (patch)
tree65bdc5cab4c435d5dbe3201f78353942b02b3f61 /sys/i386/xen/pmap.c
parente421ea1bec13fe06ecd26b4a6d6886ee80968d28 (diff)
downloadFreeBSD-src-b1adba8ac63bd3ea7ea749d7238d193761e22776.zip
FreeBSD-src-b1adba8ac63bd3ea7ea749d7238d193761e22776.tar.gz
Rename {_,}pmap_unwire_pte_hold() to {_,}pmap_unwire_ptp() and update the
comment describing them. Both the function names and the comment had grown stale. Quite some time has passed since these pmap implementations last used the page's hold count to track the number of valid mapping within a page table page. Also, returning TRUE from pmap_unwire_ptp() rather than _pmap_unwire_ptp() eliminates a few instructions from callers like pmap_enter_quick_locked() where pmap_unwire_ptp()'s return value is used directly by a conditional statement.
Diffstat (limited to 'sys/i386/xen/pmap.c')
-rw-r--r--sys/i386/xen/pmap.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/sys/i386/xen/pmap.c b/sys/i386/xen/pmap.c
index 61bc35f..b0e1624 100644
--- a/sys/i386/xen/pmap.c
+++ b/sys/i386/xen/pmap.c
@@ -300,7 +300,7 @@ static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va,
static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va, int flags);
static vm_page_t _pmap_allocpte(pmap_t pmap, u_int ptepindex, int flags);
-static int _pmap_unwire_pte_hold(pmap_t pmap, vm_page_t m, vm_page_t *free);
+static void _pmap_unwire_ptp(pmap_t pmap, vm_page_t m, vm_page_t *free);
static pt_entry_t *pmap_pte_quick(pmap_t pmap, vm_offset_t va);
static void pmap_pte_release(pt_entry_t *pte);
static int pmap_unuse_pt(pmap_t, vm_offset_t, vm_page_t *);
@@ -1333,22 +1333,25 @@ pmap_free_zero_pages(vm_page_t free)
}
/*
- * This routine unholds page table pages, and if the hold count
- * drops to zero, then it decrements the wire count.
+ * Decrements a page table page's wire count, which is used to record the
+ * number of valid page table entries within the page. If the wire count
+ * drops to zero, then the page table page is unmapped. Returns TRUE if the
+ * page table page was unmapped and FALSE otherwise.
*/
-static __inline int
-pmap_unwire_pte_hold(pmap_t pmap, vm_page_t m, vm_page_t *free)
+static inline boolean_t
+pmap_unwire_ptp(pmap_t pmap, vm_page_t m, vm_page_t *free)
{
--m->wire_count;
- if (m->wire_count == 0)
- return (_pmap_unwire_pte_hold(pmap, m, free));
- else
- return (0);
+ if (m->wire_count == 0) {
+ _pmap_unwire_ptp(pmap, m, free);
+ return (TRUE);
+ } else
+ return (FALSE);
}
-static int
-_pmap_unwire_pte_hold(pmap_t pmap, vm_page_t m, vm_page_t *free)
+static void
+_pmap_unwire_ptp(pmap_t pmap, vm_page_t m, vm_page_t *free)
{
vm_offset_t pteva;
@@ -1384,8 +1387,6 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_page_t m, vm_page_t *free)
*/
m->right = *free;
*free = m;
-
- return (1);
}
/*
@@ -1402,7 +1403,7 @@ pmap_unuse_pt(pmap_t pmap, vm_offset_t va, vm_page_t *free)
return (0);
ptepde = PT_GET(pmap_pde(pmap, va));
mpte = PHYS_TO_VM_PAGE(ptepde & PG_FRAME);
- return (pmap_unwire_pte_hold(pmap, mpte, free));
+ return (pmap_unwire_ptp(pmap, mpte, free));
}
/*
@@ -3015,7 +3016,7 @@ pmap_enter_quick_locked(multicall_entry_t **mclpp, int *count, pmap_t pmap, vm_o
!pmap_try_insert_pv_entry(pmap, va, m)) {
if (mpte != NULL) {
free = NULL;
- if (pmap_unwire_pte_hold(pmap, mpte, &free)) {
+ if (pmap_unwire_ptp(pmap, mpte, &free)) {
pmap_invalidate_page(pmap, va);
pmap_free_zero_pages(free);
}
@@ -3294,8 +3295,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len,
dst_pmap->pm_stats.resident_count++;
} else {
free = NULL;
- if (pmap_unwire_pte_hold(dst_pmap,
- dstmpte, &free)) {
+ if (pmap_unwire_ptp(dst_pmap, dstmpte,
+ &free)) {
pmap_invalidate_page(dst_pmap,
addr);
pmap_free_zero_pages(free);
OpenPOWER on IntegriCloud