Page MenuHomeFreeBSD

D16277.diff
No OneTemporary

D16277.diff

Index: head/sys/vm/vm_pageout.c
===================================================================
--- head/sys/vm/vm_pageout.c
+++ head/sys/vm/vm_pageout.c
@@ -793,18 +793,22 @@
* If the page has been referenced and the object is not dead,
* reactivate or requeue the page depending on whether the
* object is mapped.
+ *
+ * Test PGA_REFERENCED after calling pmap_ts_referenced() so
+ * that a reference from a concurrently destroyed mapping is
+ * observed here and now.
*/
- if ((m->aflags & PGA_REFERENCED) != 0) {
- vm_page_aflag_clear(m, PGA_REFERENCED);
- act_delta = 1;
- } else
- act_delta = 0;
if (object->ref_count != 0)
- act_delta += pmap_ts_referenced(m);
+ act_delta = pmap_ts_referenced(m);
else {
KASSERT(!pmap_page_is_mapped(m),
("page %p is mapped", m));
+ act_delta = 0;
}
+ if ((m->aflags & PGA_REFERENCED) != 0) {
+ vm_page_aflag_clear(m, PGA_REFERENCED);
+ act_delta++;
+ }
if (act_delta != 0) {
if (object->ref_count != 0) {
VM_CNT_INC(v_reactivated);
@@ -1215,14 +1219,11 @@
/*
* Check to see "how much" the page has been used.
- */
- if ((m->aflags & PGA_REFERENCED) != 0) {
- vm_page_aflag_clear(m, PGA_REFERENCED);
- act_delta = 1;
- } else
- act_delta = 0;
-
- /*
+ *
+ * Test PGA_REFERENCED after calling pmap_ts_referenced() so
+ * that a reference from a concurrently destroyed mapping is
+ * observed here and now.
+ *
* Perform an unsynchronized object ref count check. While
* the page lock ensures that the page is not reallocated to
* another object, in particular, one with unmanaged mappings
@@ -1236,7 +1237,13 @@
* worst, we will deactivate and reactivate the page.
*/
if (m->object->ref_count != 0)
- act_delta += pmap_ts_referenced(m);
+ act_delta = pmap_ts_referenced(m);
+ else
+ act_delta = 0;
+ if ((m->aflags & PGA_REFERENCED) != 0) {
+ vm_page_aflag_clear(m, PGA_REFERENCED);
+ act_delta++;
+ }
/*
* Advance or decay the act_count based on recent usage.
@@ -1482,17 +1489,21 @@
* If the page has been referenced and the object is not dead,
* reactivate or requeue the page depending on whether the
* object is mapped.
+ *
+ * Test PGA_REFERENCED after calling pmap_ts_referenced() so
+ * that a reference from a concurrently destroyed mapping is
+ * observed here and now.
*/
- if ((m->aflags & PGA_REFERENCED) != 0) {
- vm_page_aflag_clear(m, PGA_REFERENCED);
- act_delta = 1;
- } else
- act_delta = 0;
- if (object->ref_count != 0) {
- act_delta += pmap_ts_referenced(m);
- } else {
+ if (object->ref_count != 0)
+ act_delta = pmap_ts_referenced(m);
+ else {
KASSERT(!pmap_page_is_mapped(m),
("page %p is mapped", m));
+ act_delta = 0;
+ }
+ if ((m->aflags & PGA_REFERENCED) != 0) {
+ vm_page_aflag_clear(m, PGA_REFERENCED);
+ act_delta++;
}
if (act_delta != 0) {
if (object->ref_count != 0) {

File Metadata

Mime Type
text/plain
Expires
Mon, Jul 6, 5:48 AM (11 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34738505
Default Alt Text
D16277.diff (2 KB)

Event Timeline