PERFORCE change 188779 for review
Edward Tomasz Napierala
trasz at FreeBSD.org
Sun Feb 13 13:53:02 UTC 2011
http://p4web.freebsd.org/@@188779?ac=10
Change 188779 by trasz at trasz_victim on 2011/02/13 13:52:11
Fix logic error that could make vm_daemon() to loop indefinitely.
Affected files ...
.. //depot/projects/soc2009/trasz_limits/sys/vm/vm_pageout.c#29 edit
Differences ...
==== //depot/projects/soc2009/trasz_limits/sys/vm/vm_pageout.c#29 (text+ko) ====
@@ -1636,7 +1636,7 @@
struct proc *p;
struct thread *td;
struct vmspace *vm;
- int breakout, swapout_flags, tryagain;
+ int breakout, swapout_flags, tryagain, attempts;
uint64_t rsize, ravailable;
while (TRUE) {
@@ -1657,7 +1657,9 @@
* process is swapped out -- deactivate pages
*/
tryagain = 0;
+ attempts = 0;
again:
+ attempts++;
sx_slock(&allproc_lock);
FOREACH_PROC_IN_SYSTEM(p) {
vm_pindex_t limit, size;
@@ -1732,8 +1734,6 @@
* been exceeded by some memory hog. Don't
* try to deactivate more than 1/4th of process'
* resident set size.
- *
- * XXX: Reconsider.
*/
if (ravailable < rsize - (rsize / 4))
ravailable = rsize - (rsize / 4);
@@ -1746,19 +1746,18 @@
rusage_set(p, RUSAGE_RSS, rsize);
PROC_UNLOCK(p);
if (rsize > ravailable)
- tryagain++;
- if (tryagain > 20) {
-#if 0
- printf("still too much: rsize = %ju, ravailable = %ju\n",
- (uintmax_t)rsize, (uintmax_t)ravailable);
+ tryagain = 1;
+ if (attempts == 10) {
+#if 1
+ printf("still too much: pid %d (%s), rsize = %ju, ravailable = %ju\n",
+ p->p_pid, p->p_comm, (uintmax_t)rsize, (uintmax_t)ravailable);
#endif
- tryagain = 0;
}
}
vmspace_free(vm);
}
sx_sunlock(&allproc_lock);
- if (tryagain != 0)
+ if (tryagain != 0 && attempts <= 10)
goto again;
}
}
More information about the p4-projects
mailing list