1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

To simplify upcoming changes to the inactive queue scan, change the code

so that there is only one place where pages are freed and only one place
where pages are moved to the tail of the queue.

Reviewed by:	kib
Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
Alan Cox 2015-09-08 04:18:57 +00:00
parent c1eb4109f3
commit 27a9fb2fc2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=287550

View File

@ -1178,12 +1178,8 @@ vm_pageout_scan(struct vm_domain *vmd, int pass)
* Invalid pages can be easily freed. They cannot be
* mapped, vm_page_free() asserts this.
*/
if (m->valid == 0) {
vm_page_free(m);
PCPU_INC(cnt.v_dfree);
--page_shortage;
goto drop_page;
}
if (m->valid == 0)
goto free_page;
/*
* If the page has been referenced and the object is not dead,
@ -1214,12 +1210,8 @@ vm_pageout_scan(struct vm_domain *vmd, int pass)
*/
m->act_count += act_delta + ACT_ADVANCE;
goto drop_page;
} else if ((object->flags & OBJ_DEAD) == 0) {
vm_pagequeue_lock(pq);
queues_locked = TRUE;
vm_page_requeue_locked(m);
goto drop_page;
}
} else if ((object->flags & OBJ_DEAD) == 0)
goto requeue_page;
}
/*
@ -1240,6 +1232,7 @@ vm_pageout_scan(struct vm_domain *vmd, int pass)
/*
* Clean pages can be freed.
*/
free_page:
vm_page_free(m);
PCPU_INC(cnt.v_dfree);
--page_shortage;
@ -1266,6 +1259,7 @@ vm_pageout_scan(struct vm_domain *vmd, int pass)
* the thrash point for a heavily loaded machine.
*/
m->flags |= PG_WINATCFLS;
requeue_page:
vm_pagequeue_lock(pq);
queues_locked = TRUE;
vm_page_requeue_locked(m);
@ -1287,12 +1281,8 @@ vm_pageout_scan(struct vm_domain *vmd, int pass)
pageout_ok = vm_page_count_min();
else
pageout_ok = TRUE;
if (!pageout_ok) {
vm_pagequeue_lock(pq);
queues_locked = TRUE;
vm_page_requeue_locked(m);
goto drop_page;
}
if (!pageout_ok)
goto requeue_page;
error = vm_pageout_clean(m);
/*
* Decrement page_shortage on success to account for