diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2004-08-24 03:58:15 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2004-08-24 03:58:15 +0000 |
commit | 6200c7ba31880477e444a3df73846123673dbd2b (patch) | |
tree | 8f6672a061e0ef7947b498a56aa9710a19abe58e | |
parent | 996ca97162e84659e6c9a0679efdb0122857ebb2 (diff) |
adapt uvm_km_pages_lowat to physmem. thanks testers. ok deraadt@
-rw-r--r-- | sys/uvm/uvm_km.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/uvm/uvm_km.c b/sys/uvm/uvm_km.c index f8ce0486b85..b5dc9471727 100644 --- a/sys/uvm/uvm_km.c +++ b/sys/uvm/uvm_km.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_km.c,v 1.42 2004/07/13 14:51:29 tedu Exp $ */ +/* $OpenBSD: uvm_km.c,v 1.43 2004/08/24 03:58:14 tedu Exp $ */ /* $NetBSD: uvm_km.c,v 1.42 2001/01/14 02:10:01 thorpej Exp $ */ /* @@ -936,7 +936,7 @@ uvm_km_putpage(void *v) * not zero filled. */ -int uvm_km_pages_lowat = 128; /* allocate more when reserve drops below this */ +int uvm_km_pages_lowat; /* allocate more when reserve drops below this */ int uvm_km_pages_free; /* number of pages currently on free list */ struct km_page { struct km_page *next; @@ -957,6 +957,12 @@ uvm_km_page_init(void) struct km_page *page; int i; + if (!uvm_km_pages_lowat) { + /* based on physmem, calculate a good value here */ + uvm_km_pages_lowat = physmem / (PAGE_SIZE / 16); + if (uvm_km_pages_lowat < 128) + uvm_km_pages_lowat = 128; + } for (i = 0; i < uvm_km_pages_lowat * 4; i++) { page = (void *)uvm_km_alloc(kernel_map, PAGE_SIZE); @@ -965,6 +971,10 @@ uvm_km_page_init(void) } uvm_km_pages_free = i; + /* tone down if really high */ + if (uvm_km_pages_lowat > 512) + uvm_km_pages_lowat = 512; + kthread_create_deferred(uvm_km_createthread, NULL); } |