Changeset View
Changeset View
Standalone View
Standalone View
sys/riscv/riscv/pmap.c
Show First 20 Lines • Show All 1,062 Lines • ▼ Show 20 Lines | while (count-- > 0) { | ||||
va += PAGE_SIZE; | va += PAGE_SIZE; | ||||
} | } | ||||
pmap_invalidate_range(kernel_pmap, sva, va); | pmap_invalidate_range(kernel_pmap, sva, va); | ||||
} | } | ||||
/*************************************************** | /*************************************************** | ||||
* Page table page management routines..... | * Page table page management routines..... | ||||
***************************************************/ | ***************************************************/ | ||||
static __inline void | |||||
pmap_free_zero_pages(struct spglist *free) | |||||
{ | |||||
vm_page_t m; | |||||
while ((m = SLIST_FIRST(free)) != NULL) { | |||||
SLIST_REMOVE_HEAD(free, plinks.s.ss); | |||||
/* Preserve the page's PG_ZERO setting. */ | |||||
vm_page_free_toq(m); | |||||
} | |||||
} | |||||
/* | /* | ||||
kib: There is no much point in keeping using the pmap_free_zero_pages() when the function does not… | |||||
Not Done Inline ActionsGiven we are to remove this function, will vm_page_free_zero_pages() be a better name than vm_page_free_spglist()? ota_j.email.ne.jp: Given we are to remove this function, will vm_page_free_zero_pages() be a better name than… | |||||
* Schedule the specified unused page table page to be freed. Specifically, | * Schedule the specified unused page table page to be freed. Specifically, | ||||
* add the page to the specified list of pages that will be released to the | * add the page to the specified list of pages that will be released to the | ||||
* physical memory manager after the TLB has been updated. | * physical memory manager after the TLB has been updated. | ||||
*/ | */ | ||||
static __inline void | static __inline void | ||||
pmap_add_delayed_free_list(vm_page_t m, struct spglist *free, | pmap_add_delayed_free_list(vm_page_t m, struct spglist *free, | ||||
boolean_t set_PG_ZERO) | boolean_t set_PG_ZERO) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 785 Lines • ▼ Show 20 Lines | for (; sva < eva; sva = va_next) { | ||||
} | } | ||||
if (va != va_next) | if (va != va_next) | ||||
pmap_invalidate_range(pmap, va, sva); | pmap_invalidate_range(pmap, va, sva); | ||||
} | } | ||||
if (lock != NULL) | if (lock != NULL) | ||||
rw_wunlock(lock); | rw_wunlock(lock); | ||||
rw_runlock(&pvh_global_lock); | rw_runlock(&pvh_global_lock); | ||||
PMAP_UNLOCK(pmap); | PMAP_UNLOCK(pmap); | ||||
pmap_free_zero_pages(&free); | vm_page_free_spglist(&free); | ||||
} | } | ||||
/* | /* | ||||
* Routine: pmap_remove_all | * Routine: pmap_remove_all | ||||
* Function: | * Function: | ||||
* Removes this physical page from | * Removes this physical page from | ||||
* all physical maps in which it resides. | * all physical maps in which it resides. | ||||
* Reflects back modify bits to the pager. | * Reflects back modify bits to the pager. | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { | ||||
pmap_unuse_l3(pmap, pv->pv_va, pmap_load(l2), &free); | pmap_unuse_l3(pmap, pv->pv_va, pmap_load(l2), &free); | ||||
TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); | TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); | ||||
m->md.pv_gen++; | m->md.pv_gen++; | ||||
free_pv_entry(pmap, pv); | free_pv_entry(pmap, pv); | ||||
PMAP_UNLOCK(pmap); | PMAP_UNLOCK(pmap); | ||||
} | } | ||||
vm_page_aflag_clear(m, PGA_WRITEABLE); | vm_page_aflag_clear(m, PGA_WRITEABLE); | ||||
rw_wunlock(&pvh_global_lock); | rw_wunlock(&pvh_global_lock); | ||||
pmap_free_zero_pages(&free); | vm_page_free_spglist(&free); | ||||
} | } | ||||
/* | /* | ||||
* Set the physical protection on the | * Set the physical protection on the | ||||
* specified range of this map as requested. | * specified range of this map as requested. | ||||
*/ | */ | ||||
void | void | ||||
pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) | pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) | ||||
▲ Show 20 Lines • Show All 418 Lines • ▼ Show 20 Lines | pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, | ||||
* Enter on the PV list if part of our managed memory. | * Enter on the PV list if part of our managed memory. | ||||
*/ | */ | ||||
if ((m->oflags & VPO_UNMANAGED) == 0 && | if ((m->oflags & VPO_UNMANAGED) == 0 && | ||||
!pmap_try_insert_pv_entry(pmap, va, m, lockp)) { | !pmap_try_insert_pv_entry(pmap, va, m, lockp)) { | ||||
if (mpte != NULL) { | if (mpte != NULL) { | ||||
SLIST_INIT(&free); | SLIST_INIT(&free); | ||||
if (pmap_unwire_l3(pmap, va, mpte, &free)) { | if (pmap_unwire_l3(pmap, va, mpte, &free)) { | ||||
pmap_invalidate_page(pmap, va); | pmap_invalidate_page(pmap, va); | ||||
pmap_free_zero_pages(&free); | vm_page_free_spglist(&free); | ||||
} | } | ||||
mpte = NULL; | mpte = NULL; | ||||
} | } | ||||
return (mpte); | return (mpte); | ||||
} | } | ||||
/* | /* | ||||
* Increment counters | * Increment counters | ||||
▲ Show 20 Lines • Show All 389 Lines • ▼ Show 20 Lines | if (allfree) { | ||||
free_pv_chunk(pc); | free_pv_chunk(pc); | ||||
} | } | ||||
} | } | ||||
pmap_invalidate_all(pmap); | pmap_invalidate_all(pmap); | ||||
if (lock != NULL) | if (lock != NULL) | ||||
rw_wunlock(lock); | rw_wunlock(lock); | ||||
rw_runlock(&pvh_global_lock); | rw_runlock(&pvh_global_lock); | ||||
PMAP_UNLOCK(pmap); | PMAP_UNLOCK(pmap); | ||||
pmap_free_zero_pages(&free); | vm_page_free_spglist(&free); | ||||
} | } | ||||
/* | /* | ||||
* This is used to check if a page has been accessed or modified. As we | * This is used to check if a page has been accessed or modified. As we | ||||
* don't have a bit to see if it has been modified we have to assume it | * don't have a bit to see if it has been modified we have to assume it | ||||
* has been if the page is read/write. | * has been if the page is read/write. | ||||
*/ | */ | ||||
static boolean_t | static boolean_t | ||||
▲ Show 20 Lines • Show All 285 Lines • ▼ Show 20 Lines | if (pv != NULL && TAILQ_NEXT(pv, pv_next) != NULL) { | ||||
TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next); | TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next); | ||||
m->md.pv_gen++; | m->md.pv_gen++; | ||||
} | } | ||||
} while ((pv = TAILQ_FIRST(&m->md.pv_list)) != pvf && cleared + | } while ((pv = TAILQ_FIRST(&m->md.pv_list)) != pvf && cleared + | ||||
not_cleared < PMAP_TS_REFERENCED_MAX); | not_cleared < PMAP_TS_REFERENCED_MAX); | ||||
out: | out: | ||||
rw_wunlock(lock); | rw_wunlock(lock); | ||||
rw_runlock(&pvh_global_lock); | rw_runlock(&pvh_global_lock); | ||||
pmap_free_zero_pages(&free); | vm_page_free_spglist(&free); | ||||
return (cleared + not_cleared); | return (cleared + not_cleared); | ||||
} | } | ||||
/* | /* | ||||
* Apply the given advice to the specified range of addresses within the | * Apply the given advice to the specified range of addresses within the | ||||
* given pmap. Depending on the advice, clear the referenced and/or | * given pmap. Depending on the advice, clear the referenced and/or | ||||
* modified flags in each mapping and set the mapped page's dirty field. | * modified flags in each mapping and set the mapped page's dirty field. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 181 Lines • Show Last 20 Lines |
There is no much point in keeping using the pmap_free_zero_pages() when the function does not add any new functionality.