svn commit: r327468 - head/sys/vm
Konstantin Belousov
kib at FreeBSD.org
Mon Jan 1 19:27:34 UTC 2018
Author: kib
Date: Mon Jan 1 19:27:33 2018
New Revision: 327468
URL: https://svnweb.freebsd.org/changeset/base/327468
Log:
Do not let vm_daemon run unbounded.
On a load where single anonymous object consumes almost all memory on
the large system, swapout code executes the iteration over the
corresponding object page queue for long time, owning the map and
object locks. This blocks pagedaemon which tries to lock the object,
and blocks other threads in the process in vm_fault() waiting for the
map lock.
Handle the issue by terminating the deactivation loop if we executed
too long and by yielding at the top level in vm_daemon.
Reported by: peterj, pho
Reviewed by: alc
Tested by: pho (as part of the larger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D13671
Modified:
head/sys/vm/vm_swapout.c
Modified: head/sys/vm/vm_swapout.c
==============================================================================
--- head/sys/vm/vm_swapout.c Mon Jan 1 19:04:40 2018 (r327467)
+++ head/sys/vm/vm_swapout.c Mon Jan 1 19:27:33 2018 (r327468)
@@ -203,6 +203,8 @@ vm_swapout_object_deactivate_pages(pmap_t pmap, vm_obj
TAILQ_FOREACH(p, &object->memq, listq) {
if (pmap_resident_count(pmap) <= desired)
goto unlock_return;
+ if (should_yield())
+ goto unlock_return;
if (vm_page_busied(p))
continue;
VM_CNT_INC(v_pdpages);
@@ -516,8 +518,10 @@ again:
PRELE(p);
}
sx_sunlock(&allproc_lock);
- if (tryagain != 0 && attempts <= 10)
+ if (tryagain != 0 && attempts <= 10) {
+ maybe_yield();
goto again;
+ }
}
}
More information about the svn-src-head
mailing list