From 857b66d50529e867d79bb37f67797ae68bd97598 Mon Sep 17 00:00:00 2001 From: Alexander Kabaev Date: Sat, 13 Aug 2005 20:21:33 +0000 Subject: [PATCH] Do not use vm_pager_init() to initialize vnode_pbuf_freecnt variable. vm_pager_init() is run before required nswbuf variable has been set to correct value. This caused system to run with single pbuf available for vnode_pager. Handle both cluster_pbuf_freecnt and vnode_pbuf_freecnt variable in the same way. Reported by: ade Obtained from: alc MFC after: 2 days --- sys/kern/vfs_cluster.c | 6 ------ sys/sys/buf.h | 2 ++ sys/vm/vm_pager.c | 1 + sys/vm/vnode_pager.c | 9 --------- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c index bdc6ecf38b16..ed80fc522a91 100644 --- a/sys/kern/vfs_cluster.c +++ b/sys/kern/vfs_cluster.c @@ -78,12 +78,6 @@ SYSCTL_INT(_vfs, OID_AUTO, read_max, CTLFLAG_RW, &read_max, 0, /* Page expended to mark partially backed buffers */ extern vm_page_t bogus_page; -/* - * Number of physical bufs (pbufs) this subsystem is allowed. - * Manipulated by vm_pager.c - */ -extern int cluster_pbuf_freecnt; - /* * Read data to a buf, including read-ahead if we find this to be beneficial. * cluster_read replaces bread. diff --git a/sys/sys/buf.h b/sys/sys/buf.h index a6ba1c01022a..411fdd429e3f 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -474,6 +474,8 @@ extern char *buffers; /* The buffer contents. */ extern int bufpages; /* Number of memory pages in the buffer pool. */ extern struct buf *swbuf; /* Swap I/O buffer headers. */ extern int nswbuf; /* Number of swap I/O buffer headers. */ +extern int cluster_pbuf_freecnt; /* Number of pbufs for clusters */ +extern int vnode_pbuf_freecnt; /* Number of pbufs for vnode pager */ caddr_t kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est); void bufinit(void); diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 8cc4839a4441..d6025ab6fe5c 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -216,6 +216,7 @@ vm_pager_bufferinit() } cluster_pbuf_freecnt = nswbuf / 2; + vnode_pbuf_freecnt = nswbuf / 2 + 1; swapbkva = kmem_alloc_nofault(pager_map, nswbuf * MAXPHYS); if (!swapbkva) diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index f12bb35616d3..703f967e2a37 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -75,7 +75,6 @@ __FBSDID("$FreeBSD$"); #include #include -static void vnode_pager_init(void); static daddr_t vnode_pager_addr(struct vnode *vp, vm_ooffset_t address, int *run); static int vnode_pager_input_smlfs(vm_object_t object, vm_page_t m); @@ -87,7 +86,6 @@ static boolean_t vnode_pager_haspage(vm_object_t, vm_pindex_t, int *, int *); static vm_object_t vnode_pager_alloc(void *, vm_ooffset_t, vm_prot_t, vm_ooffset_t); struct pagerops vnodepagerops = { - .pgo_init = vnode_pager_init, .pgo_alloc = vnode_pager_alloc, .pgo_dealloc = vnode_pager_dealloc, .pgo_getpages = vnode_pager_getpages, @@ -97,13 +95,6 @@ struct pagerops vnodepagerops = { int vnode_pbuf_freecnt; -static void -vnode_pager_init(void) -{ - - vnode_pbuf_freecnt = nswbuf / 2 + 1; -} - /* Create the VM system backing object for this vnode */ int vnode_create_vobject(struct vnode *vp, size_t isize, struct thread *td)