diff options
author | alc <alc@FreeBSD.org> | 2016-10-01 19:30:28 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2016-10-01 19:30:28 +0000 |
commit | ef0b439c822bffc80175b9dfb78957bb807d576d (patch) | |
tree | 0160d2729d42e24c2952c09ab03d4166a8895bd1 /sys/i386 | |
parent | c83481c3142b3f842f75e35f0359ab1e4a918a1c (diff) | |
download | FreeBSD-src-ef0b439c822bffc80175b9dfb78957bb807d576d.zip FreeBSD-src-ef0b439c822bffc80175b9dfb78957bb807d576d.tar.gz |
MFC r305213,305319,305398
As an optimization to the machine-independent layer, change the machine-
dependent pmap_ts_referenced() so that it updates the page's dirty field
if a modified bit is found while counting reference bits. This
opportunistic update can be performed at low cost and can eliminate the
need for some future calls to pmap_is_modified() by the machine-
independent layer.
Replace the number 4 in sparc64's pmap_ts_referenced() by
PMAP_TS_REFERENCED_MAX, like we've done elsewhere, e.g., amd64.
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/i386/pmap.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index d40de0f..dad505a 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -4802,6 +4802,14 @@ retry: * XXX: The exact number of bits to check and clear is a matter that * should be tested and standardized at some point in the future for * optimal aging of shared pages. + * + * As an optimization, update the page's dirty field if a modified bit is + * found while counting reference bits. This opportunistic update can be + * performed at low cost and can eliminate the need for some future calls + * to pmap_is_modified(). However, since this function stops after + * finding PMAP_TS_REFERENCED_MAX reference bits, it may not detect some + * dirty pages. Those dirty pages will only be detected by a future call + * to pmap_is_modified(). */ int pmap_ts_referenced(vm_page_t m) @@ -4828,6 +4836,14 @@ pmap_ts_referenced(vm_page_t m) pmap = PV_PMAP(pv); PMAP_LOCK(pmap); pde = pmap_pde(pmap, pv->pv_va); + if ((*pde & (PG_M | PG_RW)) == (PG_M | PG_RW)) { + /* + * Although "*pde" is mapping a 2/4MB page, because + * this function is called at a 4KB page granularity, + * we only update the 4KB page under test. + */ + vm_page_dirty(m); + } if ((*pde & PG_A) != 0) { /* * Since this reference bit is shared by either 1024 @@ -4876,6 +4892,8 @@ small_mappings: ("pmap_ts_referenced: found a 4mpage in page %p's pv list", m)); pte = pmap_pte_quick(pmap, pv->pv_va); + if ((*pte & (PG_M | PG_RW)) == (PG_M | PG_RW)) + vm_page_dirty(m); if ((*pte & PG_A) != 0) { atomic_clear_int((u_int *)pte, PG_A); pmap_invalidate_page(pmap, pv->pv_va); |