MCPcopy Create free account
hub / github.com/F-Stack/f-stack / pmap_page_exists_quick

Function pmap_page_exists_quick

freebsd/arm64/arm64/pmap.c:4945–4982  ·  view source on GitHub ↗

* Returns true if the pmap's pv is one of the first * 16 pvs linked to from this page. This count may * be changed upwards or downwards in the future; it * is only necessary that true be returned for a small * subset of pmaps for proper page aging. */

Source from the content-addressed store, hash-verified

4943 * subset of pmaps for proper page aging.
4944 */
4945boolean_t
4946pmap_page_exists_quick(pmap_t pmap, vm_page_t m)
4947{
4948 struct md_page *pvh;
4949 struct rwlock *lock;
4950 pv_entry_t pv;
4951 int loops = 0;
4952 boolean_t rv;
4953
4954 KASSERT((m->oflags & VPO_UNMANAGED) == 0,
4955 ("pmap_page_exists_quick: page %p is not managed", m));
4956 rv = FALSE;
4957 lock = VM_PAGE_TO_PV_LIST_LOCK(m);
4958 rw_rlock(lock);
4959 TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) {
4960 if (PV_PMAP(pv) == pmap) {
4961 rv = TRUE;
4962 break;
4963 }
4964 loops++;
4965 if (loops >= 16)
4966 break;
4967 }
4968 if (!rv && loops < 16 && (m->flags & PG_FICTITIOUS) == 0) {
4969 pvh = page_to_pvh(m);
4970 TAILQ_FOREACH(pv, &pvh->pv_list, pv_next) {
4971 if (PV_PMAP(pv) == pmap) {
4972 rv = TRUE;
4973 break;
4974 }
4975 loops++;
4976 if (loops >= 16)
4977 break;
4978 }
4979 }
4980 rw_runlock(lock);
4981 return (rv);
4982}
4983
4984/*
4985 * pmap_page_wired_mappings:

Callers

nothing calls this directly

Calls 1

page_to_pvhFunction · 0.85

Tested by

no test coverage detected