aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/md
diff options
context:
space:
mode:
authorJeff Roberson <jeff@FreeBSD.org>2019-12-15 03:15:06 +0000
committerJeff Roberson <jeff@FreeBSD.org>2019-12-15 03:15:06 +0000
commita80817786433b8c78023e5086809bd673e704fd1 (patch)
treec99d966314ef679adeaa8e12bb2cb88becf174ef /sys/dev/md
parentd966c7615f74abea52e6f12981f93f16c5b4d421 (diff)
downloadsrc-a80817786433b8c78023e5086809bd673e704fd1.tar.gz
src-a80817786433b8c78023e5086809bd673e704fd1.zip
Add a deferred free mechanism for freeing swap space that does not require
an exclusive object lock. Previously swap space was freed on a best effort basis when a page that had valid swap was dirtied, thus invalidating the swap copy. This may be done inconsistently and requires the object lock which is not always convenient. Instead, track when swap space is present. The first dirty is responsible for deleting space or setting PGA_SWAP_FREE which will trigger background scans to free the swap space. Simplify the locking in vm_fault_dirty() now that we can reliably identify the first dirty. Discussed with: alc, kib, markj Differential Revision: https://reviews.freebsd.org/D22654
Notes
Notes: svn path=/head/; revision=355765
Diffstat (limited to 'sys/dev/md')
-rw-r--r--sys/dev/md/md.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index fa122a5cd8e6..da0ce6361856 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -1118,10 +1118,7 @@ mdstart_swap(struct md_s *sc, struct bio *bp)
}
vm_page_valid(m);
- if (m->dirty != VM_PAGE_BITS_ALL) {
- vm_page_dirty(m);
- vm_pager_page_unswapped(m);
- }
+ vm_page_set_dirty(m);
} else if (bp->bio_cmd == BIO_DELETE) {
if (len == PAGE_SIZE || vm_page_all_valid(m))
rv = VM_PAGER_OK;
@@ -1138,10 +1135,7 @@ mdstart_swap(struct md_s *sc, struct bio *bp)
/* Page is valid. */
if (len != PAGE_SIZE) {
pmap_zero_page_area(m, offs, len);
- if (m->dirty != VM_PAGE_BITS_ALL) {
- vm_page_dirty(m);
- vm_pager_page_unswapped(m);
- }
+ vm_page_set_dirty(m);
} else {
vm_pager_page_unswapped(m);
vm_page_free(m);