From d6d92c84c1c581d7ec6af850145ede74cfa7f2bc Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 28 Jan 2003 03:01:35 +0000 Subject: [PATCH] Merge pmap_testbit() and pmap_is_modified(). The latter is the only caller of the former. --- sys/amd64/amd64/pmap.c | 38 +++++++++----------------------------- sys/i386/i386/pmap.c | 38 +++++++++----------------------------- 2 files changed, 18 insertions(+), 58 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 76ae738a7cfc..37e0eb8a19fd 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -209,7 +209,6 @@ static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t sva); static void pmap_remove_page(struct pmap *pmap, vm_offset_t va); static int pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va); -static boolean_t pmap_testbit(vm_page_t m, int bit); static void pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t mpte, vm_page_t m); @@ -2987,14 +2986,13 @@ pmap_remove_pages(pmap, sva, eva) } /* - * pmap_testbit tests bits in pte's - * note that the testbit/changebit routines are inline, - * and a lot of things compile-time evaluate. + * pmap_is_modified: + * + * Return whether or not the specified physical page was modified + * in any physical maps. */ -static boolean_t -pmap_testbit(m, bit) - vm_page_t m; - int bit; +boolean_t +pmap_is_modified(vm_page_t m) { pv_entry_t pv; pt_entry_t *pte; @@ -3003,9 +3001,6 @@ pmap_testbit(m, bit) if (!pmap_initialized || (m->flags & PG_FICTITIOUS)) return FALSE; - if (TAILQ_FIRST(&m->md.pv_list) == NULL) - return FALSE; - s = splvm(); mtx_assert(&vm_page_queue_mtx, MA_OWNED); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { @@ -3014,11 +3009,8 @@ pmap_testbit(m, bit) * mark clean_map and ptes as never * modified. */ - if (bit & (PG_A|PG_M)) { - if (!pmap_track_modified(pv->pv_va)) - continue; - } - + if (!pmap_track_modified(pv->pv_va)) + continue; #if defined(PMAP_DIAGNOSTIC) if (!pv->pv_pmap) { printf("Null pmap (tb) at va: 0x%x\n", pv->pv_va); @@ -3026,7 +3018,7 @@ pmap_testbit(m, bit) } #endif pte = pmap_pte_quick(pv->pv_pmap, pv->pv_va); - if (*pte & bit) { + if (*pte & PG_M) { splx(s); return TRUE; } @@ -3178,18 +3170,6 @@ pmap_ts_referenced(vm_page_t m) return (rtval); } -/* - * pmap_is_modified: - * - * Return whether or not the specified physical page was modified - * in any physical maps. - */ -boolean_t -pmap_is_modified(vm_page_t m) -{ - return pmap_testbit(m, PG_M); -} - /* * Clear the modify bits on the specified physical page. */ diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 76ae738a7cfc..37e0eb8a19fd 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -209,7 +209,6 @@ static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t sva); static void pmap_remove_page(struct pmap *pmap, vm_offset_t va); static int pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va); -static boolean_t pmap_testbit(vm_page_t m, int bit); static void pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t mpte, vm_page_t m); @@ -2987,14 +2986,13 @@ pmap_remove_pages(pmap, sva, eva) } /* - * pmap_testbit tests bits in pte's - * note that the testbit/changebit routines are inline, - * and a lot of things compile-time evaluate. + * pmap_is_modified: + * + * Return whether or not the specified physical page was modified + * in any physical maps. */ -static boolean_t -pmap_testbit(m, bit) - vm_page_t m; - int bit; +boolean_t +pmap_is_modified(vm_page_t m) { pv_entry_t pv; pt_entry_t *pte; @@ -3003,9 +3001,6 @@ pmap_testbit(m, bit) if (!pmap_initialized || (m->flags & PG_FICTITIOUS)) return FALSE; - if (TAILQ_FIRST(&m->md.pv_list) == NULL) - return FALSE; - s = splvm(); mtx_assert(&vm_page_queue_mtx, MA_OWNED); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { @@ -3014,11 +3009,8 @@ pmap_testbit(m, bit) * mark clean_map and ptes as never * modified. */ - if (bit & (PG_A|PG_M)) { - if (!pmap_track_modified(pv->pv_va)) - continue; - } - + if (!pmap_track_modified(pv->pv_va)) + continue; #if defined(PMAP_DIAGNOSTIC) if (!pv->pv_pmap) { printf("Null pmap (tb) at va: 0x%x\n", pv->pv_va); @@ -3026,7 +3018,7 @@ pmap_testbit(m, bit) } #endif pte = pmap_pte_quick(pv->pv_pmap, pv->pv_va); - if (*pte & bit) { + if (*pte & PG_M) { splx(s); return TRUE; } @@ -3178,18 +3170,6 @@ pmap_ts_referenced(vm_page_t m) return (rtval); } -/* - * pmap_is_modified: - * - * Return whether or not the specified physical page was modified - * in any physical maps. - */ -boolean_t -pmap_is_modified(vm_page_t m) -{ - return pmap_testbit(m, PG_M); -} - /* * Clear the modify bits on the specified physical page. */