diff options
author | alc <alc@FreeBSD.org> | 2004-02-19 07:43:55 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2004-02-19 07:43:55 +0000 |
commit | 4583be830a6ae7272e015769b97449f07c914bac (patch) | |
tree | 7d8d590fd2e7402815b1032a6eab088bd0f7e9a8 /sys/vm/vm_page.c | |
parent | 9ad4279918a98f7fe07787608e9603a6b4d1a2ca (diff) | |
download | FreeBSD-src-4583be830a6ae7272e015769b97449f07c914bac.zip FreeBSD-src-4583be830a6ae7272e015769b97449f07c914bac.tar.gz |
- Correct a long-standing race condition in vm_page_try_to_free() that
could result in a dirty page being unintentionally freed.
- Simplify the dirty page check in vm_page_dontneed().
Reviewed by: tegge
MFC after: 7 days
Diffstat (limited to 'sys/vm/vm_page.c')
-rw-r--r-- | sys/vm/vm_page.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 9bc15fe..853178a 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -1316,11 +1316,10 @@ vm_page_try_to_free(vm_page_t m) (m->flags & (PG_BUSY|PG_UNMANAGED))) { return (0); } - vm_page_test_dirty(m); + pmap_remove_all(m); if (m->dirty) return (0); vm_page_busy(m); - pmap_remove_all(m); vm_page_free(m); return (1); } @@ -1405,8 +1404,8 @@ vm_page_dontneed(vm_page_t m) return; } - if (m->dirty == 0) - vm_page_test_dirty(m); + if (m->dirty == 0 && pmap_is_modified(m)) + vm_page_dirty(m); if (m->dirty || (dnw & 0x0070) == 0) { /* |