diff options
author | alc <alc@FreeBSD.org> | 2015-08-25 01:01:25 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2015-08-25 01:01:25 +0000 |
commit | 6181041f9a615581f84d8ad0025c36845aad472f (patch) | |
tree | d66e06872f482a845f15f46a330d7b3a801d5519 /sys/vm | |
parent | c465848fcf220d5fb2824d3829148113ecaf37fa (diff) | |
download | FreeBSD-src-6181041f9a615581f84d8ad0025c36845aad472f.zip FreeBSD-src-6181041f9a615581f84d8ad0025c36845aad472f.tar.gz |
Testing whether a page is dirty does not require the page lock. Moreover,
it may involve a pmap operation that iterates over the page's PV list, so
unnecessarily holding the page lock is undesirable.
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/vm_pageout.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 07f5444..75d21d6 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -415,10 +415,13 @@ more: ib = 0; break; } - vm_page_lock(p); vm_page_test_dirty(p); - if (p->dirty == 0 || - p->queue != PQ_INACTIVE || + if (p->dirty == 0) { + ib = 0; + break; + } + vm_page_lock(p); + if (p->queue != PQ_INACTIVE || p->hold_count != 0) { /* may be undergoing I/O */ vm_page_unlock(p); ib = 0; @@ -442,10 +445,11 @@ more: if ((p = vm_page_next(ps)) == NULL || vm_page_busied(p)) break; - vm_page_lock(p); vm_page_test_dirty(p); - if (p->dirty == 0 || - p->queue != PQ_INACTIVE || + if (p->dirty == 0) + break; + vm_page_lock(p); + if (p->queue != PQ_INACTIVE || p->hold_count != 0) { /* may be undergoing I/O */ vm_page_unlock(p); break; |