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/sparc64 | |
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/sparc64')
-rw-r--r-- | sys/sparc64/sparc64/pmap.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/sparc64/sparc64/pmap.c b/sys/sparc64/sparc64/pmap.c index 21800dd..0f06fd1 100644 --- a/sys/sparc64/sparc64/pmap.c +++ b/sys/sparc64/sparc64/pmap.c @@ -2106,6 +2106,8 @@ pmap_page_is_mapped(vm_page_t m) return (rv); } +#define PMAP_TS_REFERENCED_MAX 5 + /* * Return a count of reference bits for a page, clearing those bits. * It is not necessary for every reference bit to be cleared, but it @@ -2115,6 +2117,14 @@ pmap_page_is_mapped(vm_page_t m) * 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) @@ -2138,7 +2148,10 @@ pmap_ts_referenced(vm_page_t m) if ((tp->tte_data & TD_PV) == 0) continue; data = atomic_clear_long(&tp->tte_data, TD_REF); - if ((data & TD_REF) != 0 && ++count > 4) + if ((data & TD_W) != 0) + vm_page_dirty(m); + if ((data & TD_REF) != 0 && ++count >= + PMAP_TS_REFERENCED_MAX) break; } while ((tp = tpn) != NULL && tp != tpf); } |