Subject: CVS commit: src/sys/uvm
To: None <source-changes@netbsd.org>
From: Jason R Thorpe <thorpej@netbsd.org>
List: source-changes
Date: 03/04/2003 08:18:55
Module Name:	src
Committed By:	thorpej
Date:		Tue Mar  4 06:18:55 UTC 2003

Modified Files:
	src/sys/uvm: uvm_init.c uvm_loan.c uvm_loan.h

Log Message:
Fix the following pathological scanario:
* User allocates ZFOD region, but does not actually touch the buffer
  to fault in the pages.
* In a loop, user writes this buffer to a network socket, triggering
  sosend_loan().
* uvm_loan() calls uvm_loanzero() once for each page in the loaned
  region (since the pages have not yet faulted in).  This causes a
  page to be allocated and zero'd.  The result is the kernel spends
  a lot of time allocating and zero'ing pages.

This fixes creates a special object which owns a single zero'd page.
This single zero'd page is used to satisfy all loans of non-resident
ZFOD mappings.

Thanks to Allen Briggs for discovering the problem and for providing
an initial patch.


To generate a diff of this commit:
cvs rdiff -r1.15 -r1.16 src/sys/uvm/uvm_init.c
cvs rdiff -r1.39 -r1.40 src/sys/uvm/uvm_loan.c
cvs rdiff -r1.9 -r1.10 src/sys/uvm/uvm_loan.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.