Subject: Re: memory tester shows up swap/page tuning bug [was Re: BUFFERCACHE,
To: None <tech-kern@NetBSD.ORG>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: tech-kern
Date: 09/15/1996 19:42:26
John Dyson writes:


>Try this.  Sleeping on lbolt is a bit bogus.  Waking up on vm_pages_needed
>is likely more correct, with a timeout of some reasonable amount of time.
>(I don't know what the hz variable is on NetBSD, so I just filled in a
>number.)  No guarantees -- this fix (if I think what the problem is)
>is not quite correct.  A correct fix is much much more complex :-).
>
>Good luck!!!
>
>*** vm_pageout.c	Mon Feb  5 07:26:54 1996
>--- vm_pageout.c.new	Sun Sep 15 20:19:18 1996
>***************
>*** 325,333 ****
>  		 * FAIL on a write is interpreted to mean a resource
>  		 * shortage, so we put pause for awhile and try again.
>  		 * XXX could get stuck here.
>  		 */
>! 		(void) tsleep((caddr_t)&lbolt, PZERO|PCATCH, "pageout", 0);
>  		break;
>  	}
>  	case VM_PAGER_FAIL:
>  	case VM_PAGER_ERROR:
>--- 325,334 ----
>  		 * FAIL on a write is interpreted to mean a resource
>  		 * shortage, so we put pause for awhile and try again.
>  		 * XXX could get stuck here.
>  		 */
>! 		(void) tsleep((caddr_t)&vm_pages_needed,
>! 			PZERO|PCATCH, "pageout", 100);
>  		break;
>  	}
>  	case VM_PAGER_FAIL:
>  	case VM_PAGER_ERROR:
>
>
>--------


As I wrote in an earlier message to John Dyson.

This patch *does* seem to avoid the complete freezes.  Instead of
dirtying every page in the active list, exhasting the free list, and
then freezing whilst the dirty pages are dribbled out to disk at
v_min_free/sec, the VM system is now cleaning the pages continuously.
Pages are being written back to disk at a steady rate of about 5% of
the pageout rate the hardware I'm using can sustain (e.g., what it
reaches during the free-running part of the cyclic, pathological
case.)


It's *much* better than nothing, though. Thank you.

Discussion about how to improve this is ongoing....

--Jonathan