1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-15 15:06:42 +00:00

Replace a bunch of:

for (pv = TAILQ_FIRST(&m->md.pv_list);
               pv;
               pv = TAILQ_NEXT(pv, pv_list)) {
with:
      TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
This commit is contained in:
Peter Wemm 2001-12-20 05:29:59 +00:00
parent 61404abce8
commit ff5a52e18e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=88245
4 changed files with 31 additions and 98 deletions

View File

@ -1855,16 +1855,12 @@ pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va)
s = splvm();
if (m->md.pv_list_count < pmap->pm_stats.resident_count) {
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
if (pmap == pv->pv_pmap && va == pv->pv_va)
break;
}
} else {
for (pv = TAILQ_FIRST(&pmap->pm_pvlist);
pv;
pv = TAILQ_NEXT(pv, pv_plist)) {
TAILQ_FOREACH(pv, &pmap->pm_pvlist, pv_plist) {
if (va == pv->pv_va)
break;
}
@ -2762,9 +2758,7 @@ pmap_page_exists(pmap, m)
/*
* Not found, check current mappings returning immediately if found.
*/
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
if (pv->pv_pmap == pmap) {
splx(s);
return TRUE;
@ -2870,10 +2864,7 @@ pmap_changebit(vm_page_t m, int bit, boolean_t setem)
* Loop over all current mappings setting/clearing as appropos If
* setting RO do we need to clear the VAC?
*/
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
/*
* don't write protect pager mappings
*/
@ -2953,9 +2944,7 @@ pmap_ts_referenced(vm_page_t m)
* reference trap recently).
*/
count = 0;
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
pte = pmap_lev3pte(pv->pv_pmap, pv->pv_va);
if (!(*pte & PG_FOR)) {
@ -2987,9 +2976,7 @@ pmap_is_modified(vm_page_t m)
* A page is modified if any mapping has had its PG_FOW flag
* cleared.
*/
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
pte = pmap_lev3pte(pv->pv_pmap, pv->pv_va);
if (!(*pte & PG_FOW))
return 1;
@ -3013,9 +3000,7 @@ pmap_clear_modify(vm_page_t m)
/*
* Loop over current mappings setting PG_FOW where needed.
*/
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
pte = pmap_lev3pte(pv->pv_pmap, pv->pv_va);
if (!(*pte & PG_FOW)) {
@ -3055,9 +3040,7 @@ pmap_clear_reference(vm_page_t m)
/*
* Loop over current mappings setting PG_FOR and PG_FOE where needed.
*/
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
pte = pmap_lev3pte(pv->pv_pmap, pv->pv_va);
if (!(*pte & (PG_FOR | PG_FOE))) {
@ -3402,9 +3385,7 @@ pmap_pvdump(pa)
printf("pa %x", pa);
m = PHYS_TO_VM_PAGE(pa);
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
printf(" -> pmap %p, va %x", (void *)pv->pv_pmap, pv->pv_va);
pads(pv->pv_pmap);
}

View File

@ -1726,16 +1726,12 @@ pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va)
s = splvm();
if (m->md.pv_list_count < pmap->pm_stats.resident_count) {
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
if (pmap == pv->pv_pmap && va == pv->pv_va)
break;
}
} else {
for (pv = TAILQ_FIRST(&pmap->pm_pvlist);
pv;
pv = TAILQ_NEXT(pv, pv_plist)) {
TAILQ_FOREACH(pv, &pmap->pm_pvlist, pv_plist) {
if (va == pv->pv_va)
break;
}
@ -2954,9 +2950,7 @@ pmap_page_exists(pmap, m)
/*
* Not found, check current mappings returning immediately if found.
*/
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
if (pv->pv_pmap == pmap) {
splx(s);
return TRUE;
@ -3078,10 +3072,7 @@ pmap_testbit(m, bit)
s = splvm();
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
/*
* if the bit being tested is the modified bit, then
* mark clean_map and ptes as never
@ -3127,10 +3118,7 @@ pmap_changebit(vm_page_t m, int bit, boolean_t setem)
* Loop over all current mappings setting/clearing as appropos If
* setting RO do we need to clear the VAC?
*/
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
/*
* don't write protect pager mappings
*/
@ -3558,9 +3546,7 @@ pmap_pvdump(pa)
printf("pa %x", pa);
m = PHYS_TO_VM_PAGE(pa);
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
printf(" -> pmap %p, va %x", (void *)pv->pv_pmap, pv->pv_va);
pads(pv->pv_pmap);
}

View File

@ -1726,16 +1726,12 @@ pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va)
s = splvm();
if (m->md.pv_list_count < pmap->pm_stats.resident_count) {
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
if (pmap == pv->pv_pmap && va == pv->pv_va)
break;
}
} else {
for (pv = TAILQ_FIRST(&pmap->pm_pvlist);
pv;
pv = TAILQ_NEXT(pv, pv_plist)) {
TAILQ_FOREACH(pv, &pmap->pm_pvlist, pv_plist) {
if (va == pv->pv_va)
break;
}
@ -2954,9 +2950,7 @@ pmap_page_exists(pmap, m)
/*
* Not found, check current mappings returning immediately if found.
*/
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
if (pv->pv_pmap == pmap) {
splx(s);
return TRUE;
@ -3078,10 +3072,7 @@ pmap_testbit(m, bit)
s = splvm();
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
/*
* if the bit being tested is the modified bit, then
* mark clean_map and ptes as never
@ -3127,10 +3118,7 @@ pmap_changebit(vm_page_t m, int bit, boolean_t setem)
* Loop over all current mappings setting/clearing as appropos If
* setting RO do we need to clear the VAC?
*/
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
/*
* don't write protect pager mappings
*/
@ -3558,9 +3546,7 @@ pmap_pvdump(pa)
printf("pa %x", pa);
m = PHYS_TO_VM_PAGE(pa);
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
printf(" -> pmap %p, va %x", (void *)pv->pv_pmap, pv->pv_va);
pads(pv->pv_pmap);
}

View File

@ -1113,16 +1113,12 @@ pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va, pv_entry_t pv)
{
if (!pv) {
if (m->md.pv_list_count < pmap->pm_stats.resident_count) {
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
if (pmap == pv->pv_pmap && va == pv->pv_va)
break;
}
} else {
for (pv = TAILQ_FIRST(&pmap->pm_pvlist);
pv;
pv = TAILQ_NEXT(pv, pv_plist)) {
TAILQ_FOREACH(pv, &pmap->pm_pvlist, pv_plist) {
if (va == pv->pv_va)
break;
}
@ -1505,9 +1501,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
}
if (pmap->pm_stats.resident_count < ((eva - sva) >> PAGE_SHIFT)) {
for (pv = TAILQ_FIRST(&pmap->pm_pvlist);
pv;
pv = TAILQ_NEXT(pv, pv_plist)) {
TAILQ_FOREACH(pv, &pmap->pm_pvlist, pv_plist) {
va = pv->pv_va;
if (va >= sva && va < eva) {
pte = pmap_find_vhpt(va);
@ -2174,9 +2168,7 @@ pmap_page_exists(pmap_t pmap, vm_page_t m)
/*
* Not found, check current mappings returning immediately if found.
*/
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
if (pv->pv_pmap == pmap) {
splx(s);
return TRUE;
@ -2252,9 +2244,7 @@ pmap_page_protect(vm_page_t m, vm_prot_t prot)
if ((prot & VM_PROT_WRITE) != 0)
return;
if (prot & (VM_PROT_READ | VM_PROT_EXECUTE)) {
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
int newprot = pte_prot(pv->pv_pmap, prot);
pmap_t oldpmap = pmap_install(pv->pv_pmap);
struct ia64_lpte *pte;
@ -2290,9 +2280,7 @@ pmap_ts_referenced(vm_page_t m)
if (!pmap_initialized || (m->flags & PG_FICTITIOUS))
return 0;
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
pmap_t oldpmap = pmap_install(pv->pv_pmap);
struct ia64_lpte *pte;
pte = pmap_find_vhpt(pv->pv_va);
@ -2323,9 +2311,7 @@ pmap_is_referenced(vm_page_t m)
if (!pmap_initialized || (m->flags & PG_FICTITIOUS))
return FALSE;
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
pmap_t oldpmap = pmap_install(pv->pv_pmap);
struct ia64_lpte *pte = pmap_find_vhpt(pv->pv_va);
pmap_install(oldpmap);
@ -2351,9 +2337,7 @@ pmap_is_modified(vm_page_t m)
if (!pmap_initialized || (m->flags & PG_FICTITIOUS))
return FALSE;
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
pmap_t oldpmap = pmap_install(pv->pv_pmap);
struct ia64_lpte *pte = pmap_find_vhpt(pv->pv_va);
pmap_install(oldpmap);
@ -2375,9 +2359,7 @@ pmap_clear_modify(vm_page_t m)
if (!pmap_initialized || (m->flags & PG_FICTITIOUS))
return;
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
pmap_t oldpmap = pmap_install(pv->pv_pmap);
struct ia64_lpte *pte = pmap_find_vhpt(pv->pv_va);
if (pte->pte_d) {
@ -2402,9 +2384,7 @@ pmap_clear_reference(vm_page_t m)
if (!pmap_initialized || (m->flags & PG_FICTITIOUS))
return;
for (pv = TAILQ_FIRST(&m->md.pv_list);
pv;
pv = TAILQ_NEXT(pv, pv_list)) {
TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
pmap_t oldpmap = pmap_install(pv->pv_pmap);
struct ia64_lpte *pte = pmap_find_vhpt(pv->pv_va);
if (pte->pte_a) {