mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
o Lock page queue accesses by vm_page_activate() and vm_page_deactivate()
in vm_pageout_object_deactivate_pages(). o Apply some style fixes to vm_pageout_object_deactivate_pages().
This commit is contained in:
parent
0ea5e55265
commit
ce18aebde4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=100740
@ -461,8 +461,7 @@ vm_pageout_object_deactivate_pages(map, object, desired, map_remove_only)
|
|||||||
int map_remove_only;
|
int map_remove_only;
|
||||||
{
|
{
|
||||||
vm_page_t p, next;
|
vm_page_t p, next;
|
||||||
int rcount;
|
int actcount, rcount, remove_mode;
|
||||||
int remove_mode;
|
|
||||||
|
|
||||||
GIANT_REQUIRED;
|
GIANT_REQUIRED;
|
||||||
if (object->type == OBJT_DEVICE || object->type == OBJT_PHYS)
|
if (object->type == OBJT_DEVICE || object->type == OBJT_PHYS)
|
||||||
@ -482,10 +481,12 @@ vm_pageout_object_deactivate_pages(map, object, desired, map_remove_only)
|
|||||||
*/
|
*/
|
||||||
rcount = object->resident_page_count;
|
rcount = object->resident_page_count;
|
||||||
p = TAILQ_FIRST(&object->memq);
|
p = TAILQ_FIRST(&object->memq);
|
||||||
|
vm_page_lock_queues();
|
||||||
while (p && (rcount-- > 0)) {
|
while (p && (rcount-- > 0)) {
|
||||||
int actcount;
|
if (pmap_resident_count(map->pmap) <= desired) {
|
||||||
if (pmap_resident_count(vm_map_pmap(map)) <= desired)
|
vm_page_unlock_queues();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
next = TAILQ_NEXT(p, listq);
|
next = TAILQ_NEXT(p, listq);
|
||||||
cnt.v_pdpages++;
|
cnt.v_pdpages++;
|
||||||
if (p->wire_count != 0 ||
|
if (p->wire_count != 0 ||
|
||||||
@ -496,14 +497,12 @@ vm_pageout_object_deactivate_pages(map, object, desired, map_remove_only)
|
|||||||
p = next;
|
p = next;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
actcount = pmap_ts_referenced(p);
|
actcount = pmap_ts_referenced(p);
|
||||||
if (actcount) {
|
if (actcount) {
|
||||||
vm_page_flag_set(p, PG_REFERENCED);
|
vm_page_flag_set(p, PG_REFERENCED);
|
||||||
} else if (p->flags & PG_REFERENCED) {
|
} else if (p->flags & PG_REFERENCED) {
|
||||||
actcount = 1;
|
actcount = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((p->queue != PQ_ACTIVE) &&
|
if ((p->queue != PQ_ACTIVE) &&
|
||||||
(p->flags & PG_REFERENCED)) {
|
(p->flags & PG_REFERENCED)) {
|
||||||
vm_page_activate(p);
|
vm_page_activate(p);
|
||||||
@ -530,9 +529,9 @@ vm_pageout_object_deactivate_pages(map, object, desired, map_remove_only)
|
|||||||
}
|
}
|
||||||
p = next;
|
p = next;
|
||||||
}
|
}
|
||||||
|
vm_page_unlock_queues();
|
||||||
object = object->backing_object;
|
object = object->backing_object;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user