diff options
author | alc <alc@FreeBSD.org> | 2005-11-13 02:17:05 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2005-11-13 02:17:05 +0000 |
commit | 29e067429cebcc0b5e2ff2eb02256c941ceab3a0 (patch) | |
tree | a16e10b52bb7f5f50f3ca5f535808b63d4d0b1f9 | |
parent | 37b68acabbddca178948dd57d7b3ffc16edf8cd2 (diff) | |
download | FreeBSD-src-29e067429cebcc0b5e2ff2eb02256c941ceab3a0.zip FreeBSD-src-29e067429cebcc0b5e2ff2eb02256c941ceab3a0.tar.gz |
In get_pv_entry() use PMAP_LOCK() instead of PMAP_TRYLOCK() when deadlock
cannot possibly occur.
-rw-r--r-- | sys/alpha/alpha/pmap.c | 5 | ||||
-rw-r--r-- | sys/amd64/amd64/pmap.c | 5 | ||||
-rw-r--r-- | sys/i386/i386/pmap.c | 5 | ||||
-rw-r--r-- | sys/ia64/ia64/pmap.c | 5 |
4 files changed, 16 insertions, 4 deletions
diff --git a/sys/alpha/alpha/pmap.c b/sys/alpha/alpha/pmap.c index 9ce77cd..173755b 100644 --- a/sys/alpha/alpha/pmap.c +++ b/sys/alpha/alpha/pmap.c @@ -1338,7 +1338,10 @@ retry: TAILQ_FOREACH_SAFE(pv, &m->md.pv_list, pv_list, next_pv) { va = pv->pv_va; pmap = pv->pv_pmap; - if (pmap != locked_pmap && !PMAP_TRYLOCK(pmap)) + /* Avoid deadlock and lock recursion. */ + if (pmap > locked_pmap) + PMAP_LOCK(pmap); + else if (pmap != locked_pmap && !PMAP_TRYLOCK(pmap)) continue; pmap->pm_stats.resident_count--; pte = pmap_lev3pte(pmap, va); diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 6c7da48..c623495 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1467,7 +1467,10 @@ retry: TAILQ_FOREACH_SAFE(pv, &m->md.pv_list, pv_list, next_pv) { va = pv->pv_va; pmap = pv->pv_pmap; - if (pmap != locked_pmap && !PMAP_TRYLOCK(pmap)) + /* Avoid deadlock and lock recursion. */ + if (pmap > locked_pmap) + PMAP_LOCK(pmap); + else if (pmap != locked_pmap && !PMAP_TRYLOCK(pmap)) continue; pmap->pm_stats.resident_count--; pte = pmap_pte_pde(pmap, va, &ptepde); diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 0295f77..f7e17fa 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -1483,7 +1483,10 @@ retry: TAILQ_FOREACH_SAFE(pv, &m->md.pv_list, pv_list, next_pv) { va = pv->pv_va; pmap = pv->pv_pmap; - if (pmap != locked_pmap && !PMAP_TRYLOCK(pmap)) + /* Avoid deadlock and lock recursion. */ + if (pmap > locked_pmap) + PMAP_LOCK(pmap); + else if (pmap != locked_pmap && !PMAP_TRYLOCK(pmap)) continue; pmap->pm_stats.resident_count--; pte = pmap_pte_quick(pmap, va); diff --git a/sys/ia64/ia64/pmap.c b/sys/ia64/ia64/pmap.c index 0c900b8..98e494f 100644 --- a/sys/ia64/ia64/pmap.c +++ b/sys/ia64/ia64/pmap.c @@ -850,7 +850,10 @@ retry: TAILQ_FOREACH_SAFE(pv, &m->md.pv_list, pv_list, next_pv) { va = pv->pv_va; pmap = pv->pv_pmap; - if (pmap != locked_pmap && !PMAP_TRYLOCK(pmap)) + /* Avoid deadlock and lock recursion. */ + if (pmap > locked_pmap) + PMAP_LOCK(pmap); + else if (pmap != locked_pmap && !PMAP_TRYLOCK(pmap)) continue; oldpmap = pmap_install(pmap); pte = pmap_find_vhpt(va); |