mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-12 14:29:28 +00:00
Simplify and clean up pmap_clearbit()
There is no need for calling vm_page_dirty() when clearing "modified" flag as it is already set for that page in pmap_fault_fixup() or pmap_enter() thanks to "modified" bit emulation. Also, there is no need for checking PTE "referenced" or "writeable" flags. If there is a request to clear a particular flag we should just do it. Submitted by: Zbigniew Bodek <zbb@semihalf.com> Reviewed by: gber Sponsored by: The FreeBSD Foundation, Semihalf
This commit is contained in:
parent
1662b00871
commit
ec34d19b9d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=254535
@ -900,9 +900,6 @@ pmap_clearbit(struct vm_page *m, u_int maskbits)
|
||||
|
||||
rw_wlock(&pvh_global_lock);
|
||||
|
||||
if (maskbits & PVF_WRITE)
|
||||
maskbits |= PVF_MOD;
|
||||
|
||||
if (TAILQ_EMPTY(&m->md.pv_list)) {
|
||||
rw_wunlock(&pvh_global_lock);
|
||||
return (0);
|
||||
@ -924,14 +921,12 @@ pmap_clearbit(struct vm_page *m, u_int maskbits)
|
||||
ptep = &l2b->l2b_kva[l2pte_index(va)];
|
||||
npte = opte = *ptep;
|
||||
|
||||
if ((maskbits & (PVF_WRITE|PVF_MOD)) && L2_S_WRITABLE(opte)) {
|
||||
vm_page_dirty(m);
|
||||
|
||||
if (maskbits & (PVF_WRITE | PVF_MOD)) {
|
||||
/* make the pte read only */
|
||||
npte |= L2_APX;
|
||||
}
|
||||
|
||||
if ((maskbits & PVF_REF) && L2_S_REFERENCED(opte)) {
|
||||
if (maskbits & PVF_REF) {
|
||||
/*
|
||||
* Clear referenced flag in PTE so that we
|
||||
* will take a flag fault the next time the mapping
|
||||
|
Loading…
Reference in New Issue
Block a user