Date: Sun, 13 Feb 2011 13:53:01 GMT From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 188779 for review Message-ID: <201102131353.p1DDr1BV062386@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@188779?ac=10 Change 188779 by trasz@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; } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102131353.p1DDr1BV062386>