In the rare case that vm_page_cache() actually frees the given page,

it must first ensure that the page is no longer mapped.  This is
trivially accomplished by calling pmap_remove_all() a little earlier
in vm_page_cache().  While I'm in the neighborbood, make a related
panic message a little more useful.

Approved by:	re (kensmith)
Reported by:	Peter Holm and Konstantin Belousov
Reviewed by:	Konstantin Belousov
This commit is contained in:
Alan Cox 2007-10-08 18:01:38 +00:00
parent 59a2d0779b
commit b8c5048025
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=172472

View file

@ -1506,6 +1506,9 @@ vm_page_cache(vm_page_t m)
m->hold_count || m->wire_count) {
panic("vm_page_cache: attempting to cache busy page");
}
pmap_remove_all(m);
if (m->dirty != 0)
panic("vm_page_cache: page %p is dirty", m);
if (m->valid == 0 || object->type == OBJT_DEFAULT) {
/*
* Hypothesis: A cache-elgible page belonging to a
@ -1518,16 +1521,6 @@ vm_page_cache(vm_page_t m)
("vm_page_cache: page %p is already cached", m));
cnt.v_tcached++;
/*
* Remove all pmaps and indicate that the page is not
* writeable or mapped.
*/
pmap_remove_all(m);
if (m->dirty != 0) {
panic("vm_page_cache: caching a dirty page, pindex: %ld",
(long)m->pindex);
}
/*
* Remove the page from the paging queues.
*/