diff options
author | alc <alc@FreeBSD.org> | 2014-01-18 20:02:59 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2014-01-18 20:02:59 +0000 |
commit | d98c6ca3a185ed8b22f5000842e8b82ddb6c3195 (patch) | |
tree | ecf196b1e53ab33fddc977de4b605bca5fd742f0 /sys/vm | |
parent | 9f1142ff9549d6595d71a9c64b7f2cbc660753fc (diff) | |
download | FreeBSD-src-d98c6ca3a185ed8b22f5000842e8b82ddb6c3195.zip FreeBSD-src-d98c6ca3a185ed8b22f5000842e8b82ddb6c3195.tar.gz |
Style changes in vm_pageout_scan():
1. Be consistent in the style of "act_delta" manipulations between the
inactive and active queue scans.
2. Explicitly compare to zero.
3. The deactivation of a page is based is based on its recent history
and not just the current call to vm_pageout_scan(). The variable
"act_delta" represents the current state of the page, and not its
history. Avoid possible confusion by not (ab)using "act_delta" for
the making the deactivation decision.
Submitted by: kib [1]
Reviewed by: kib [2,3]
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_pageout.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index d2ccfa0..517491f 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -1047,11 +1047,11 @@ vm_pageout_scan(struct vm_domain *vmd, int pass) * level VM system not knowing anything about existing * references. */ - act_delta = 0; 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 { @@ -1064,7 +1064,7 @@ vm_pageout_scan(struct vm_domain *vmd, int pass) * references, we reactivate the page or requeue it. */ if (act_delta != 0) { - if (object->ref_count) { + if (object->ref_count != 0) { vm_page_activate(m); m->act_count += act_delta + ACT_ADVANCE; } else { @@ -1361,11 +1361,12 @@ relock_queues: /* * Check to see "how much" the page has been used. */ - act_delta = 0; - if (m->aflags & PGA_REFERENCED) { + if ((m->aflags & PGA_REFERENCED) != 0) { vm_page_aflag_clear(m, PGA_REFERENCED); - act_delta += 1; - } + act_delta = 1; + } else + act_delta = 0; + /* * Unlocked object ref count check. Two races are possible. * 1) The ref was transitioning to zero and we saw non-zero, @@ -1380,20 +1381,18 @@ relock_queues: /* * Advance or decay the act_count based on recent usage. */ - if (act_delta) { + if (act_delta != 0) { m->act_count += ACT_ADVANCE + act_delta; if (m->act_count > ACT_MAX) m->act_count = ACT_MAX; - } else { + } else m->act_count -= min(m->act_count, ACT_DECLINE); - act_delta = m->act_count; - } /* * Move this page to the tail of the active or inactive * queue depending on usage. */ - if (act_delta == 0) { + if (m->act_count == 0) { /* Dequeue to avoid later lock recursion. */ vm_page_dequeue_locked(m); vm_page_deactivate(m); |