- Correct a long-standing race condition in vm_page_try_to_cache() that
could result in a panic "vm_page_cache: caching a dirty page, ...": Access to the page must be restricted or removed before calling vm_page_cache(). This race condition is identical in nature to that which was addressed by vm_pageout.c's revision 1.251. - Simplify the code surrounding the fix to this same race condition in vm_pageout.c's revision 1.251. There should be no behavioral change. Reviewed by: tegge MFC after: 7 days
This commit is contained in:
parent
b662bdc270
commit
84d98bf699
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=125798
@ -1292,7 +1292,7 @@ vm_page_try_to_cache(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_cache(m);
|
||||
|
@ -801,8 +801,7 @@ vm_pageout_scan(int pass)
|
||||
* far as the VM code knows, any partially dirty pages are
|
||||
* fully dirty.
|
||||
*/
|
||||
if (m->dirty == 0) {
|
||||
vm_page_test_dirty(m);
|
||||
if (m->dirty == 0 && !pmap_is_modified(m)) {
|
||||
/*
|
||||
* Avoid a race condition: Unless write access is
|
||||
* removed from the page, another processor could
|
||||
@ -816,7 +815,7 @@ vm_pageout_scan(int pass)
|
||||
* to the page, removing all access will be cheaper
|
||||
* overall.
|
||||
*/
|
||||
if (m->dirty == 0 && (m->flags & PG_WRITEABLE) != 0)
|
||||
if ((m->flags & PG_WRITEABLE) != 0)
|
||||
pmap_remove_all(m);
|
||||
} else {
|
||||
vm_page_dirty(m);
|
||||
|
Loading…
Reference in New Issue
Block a user