uvm_extern.h is the header people should be consuming.  change a few uvm.h 
to uvm_extern.h.

a couple other sys .h headers included uvm when they don't need to.  fix 
that.

fix a few .c files that depended on getting headers from headers.

also, simplify and move the bufcache adjustment code from sysctl to the 
vfs_bio.c where it fits nicer.

Index: arch/i386/i386/machdep.c
===================================================================
RCS file: /home/tedu/cvs/src/sys/arch/i386/i386/machdep.c,v
retrieving revision 1.500
diff -u -r1.500 machdep.c
--- arch/i386/i386/machdep.c    5 Jun 2011 19:41:07 -0000       1.500
+++ arch/i386/i386/machdep.c    20 Jun 2011 19:26:09 -0000
@@ -83,7 +83,6 @@
 #include <sys/mbuf.h>
 #include <sys/msgbuf.h>
 #include <sys/mount.h>
-#include <sys/vnode.h>
 #include <sys/device.h>
 #include <sys/extent.h>
 #include <sys/sysctl.h>
@@ -101,6 +100,7 @@
 
 #include <uvm/uvm_extern.h>
 #include <uvm/uvm_swap.h>
+#include <uvm/uvm.h>
 
 #include <machine/bus.h>
 
Index: kern/exec_subr.c
===================================================================
RCS file: /home/tedu/cvs/src/sys/kern/exec_subr.c,v
retrieving revision 1.28
diff -u -r1.28 exec_subr.c
--- kern/exec_subr.c    14 Nov 2006 18:00:27 -0000      1.28
+++ kern/exec_subr.c    20 Jun 2011 19:22:34 -0000
@@ -41,7 +41,7 @@
 #include <sys/mman.h>
 #include <sys/resourcevar.h>
 
-#include <uvm/uvm.h>
+#include <uvm/uvm_extern.h>
 
 #ifdef DEBUG
 /*
Index: kern/init_main.c
===================================================================
RCS file: /home/tedu/cvs/src/sys/kern/init_main.c,v
retrieving revision 1.177
diff -u -r1.177 init_main.c
--- kern/init_main.c    18 Apr 2011 21:44:56 -0000      1.177
+++ kern/init_main.c    20 Jun 2011 19:22:34 -0000
@@ -85,7 +85,7 @@
 
 #include <machine/cpu.h>
 
-#include <uvm/uvm.h>
+#include <uvm/uvm_extern.h>
 
 #include <net/if.h>
 #include <net/raw_cb.h>
Index: kern/kern_fork.c
===================================================================
RCS file: /home/tedu/cvs/src/sys/kern/kern_fork.c,v
retrieving revision 1.126
diff -u -r1.126 kern_fork.c
--- kern/kern_fork.c    6 Jun 2011 17:05:46 -0000       1.126
+++ kern/kern_fork.c    20 Jun 2011 19:27:20 -0000
@@ -64,6 +64,7 @@
 
 #include <uvm/uvm_extern.h>
 #include <uvm/uvm_map.h>
+#include <uvm/uvm.h>
 
 int    nprocs = 1;             /* process 0 */
 int    randompid;              /* when set to 1, pid's go random */
Index: kern/kern_sysctl.c
===================================================================
RCS file: /home/tedu/cvs/src/sys/kern/kern_sysctl.c,v
retrieving revision 1.203
diff -u -r1.203 kern_sysctl.c
--- kern/kern_sysctl.c  9 Jun 2011 21:10:55 -0000       1.203
+++ kern/kern_sysctl.c  20 Jun 2011 19:22:34 -0000
@@ -565,22 +565,17 @@
                return (sysctl_int(oldp, oldlenp, newp, newlen,
                    &rthreads_enabled));
        case KERN_CACHEPCT: {
-               u_int64_t dmapages;
-               int opct, pgs;
-               opct = bufcachepercent;
+               int newpct = bufcachepercent;
                error = sysctl_int(oldp, oldlenp, newp, newlen,
-                   &bufcachepercent);
+                   &newpct);
                if (error)
                        return(error);
-               if (bufcachepercent > 90 || bufcachepercent < 5) {
-                       bufcachepercent = opct;
+               if (newpct > 90 || newpct < 5) {
                        return (EINVAL);
                }
-               dmapages = uvm_pagecount(&dma_constraint);
-               if (bufcachepercent != opct) {
-                       pgs = bufcachepercent * dmapages / 100;
-                       bufadjust(pgs); /* adjust bufpages */
-                       bufhighpages = bufpages; /* set high water mark */
+               if (bufcachepercent != newpct) {
+                       bufcachepercent = newpct;
+                       bufadjustpct();
                }
                return(0);
        }
Index: kern/uipc_mbuf.c
===================================================================
RCS file: /home/tedu/cvs/src/sys/kern/uipc_mbuf.c,v
retrieving revision 1.157
diff -u -r1.157 uipc_mbuf.c
--- kern/uipc_mbuf.c    4 May 2011 16:05:49 -0000       1.157
+++ kern/uipc_mbuf.c    20 Jun 2011 19:22:34 -0000
@@ -89,7 +89,6 @@
 
 #include <machine/cpu.h>
 
-#include <uvm/uvm.h>
 #include <uvm/uvm_extern.h>
 
 #ifdef DDB
Index: kern/vfs_bio.c
===================================================================
RCS file: /home/tedu/cvs/src/sys/kern/vfs_bio.c,v
retrieving revision 1.130
diff -u -r1.130 vfs_bio.c
--- kern/vfs_bio.c      5 Jun 2011 19:41:04 -0000       1.130
+++ kern/vfs_bio.c      20 Jun 2011 19:22:34 -0000
@@ -58,6 +58,7 @@
 #include <sys/kernel.h>
 
 #include <uvm/uvm_extern.h>
+#include <uvm/uvm.h>                   /* need dma_constraint */
 
 #include <miscfs/specfs/specdev.h>
 
@@ -119,6 +120,8 @@
 struct proc *cleanerproc;
 int bd_req;                    /* Sleep point for cleaner daemon. */
 
+void bufadjust(int);
+
 void
 bremfree(struct buf *bp)
 {
@@ -322,6 +325,18 @@
                tsleep(&needbuffer, PRIBIO, "needbuffer", 0);
        }
        splx(s);
+}
+
+void
+bufadjustpct(void)
+{
+       u_int64_t dmapages;
+       int pgs;
+
+       dmapages = uvm_pagecount(&dma_constraint);
+       pgs = bufcachepercent * dmapages / 100;
+       bufadjust(pgs); /* adjust bufpages */
+       bufhighpages = bufpages; /* set high water mark */
 }
 
 /*
Index: kern/vfs_biomem.c
===================================================================
RCS file: /home/tedu/cvs/src/sys/kern/vfs_biomem.c,v
retrieving revision 1.17
diff -u -r1.17 vfs_biomem.c
--- kern/vfs_biomem.c   7 Apr 2011 19:07:42 -0000       1.17
+++ kern/vfs_biomem.c   20 Jun 2011 19:22:34 -0000
@@ -24,7 +24,6 @@
 #include <sys/mount.h>
 
 #include <uvm/uvm_extern.h>
-#include <uvm/uvm.h>
 
 vaddr_t buf_kva_start, buf_kva_end;
 int buf_needva;
Index: sys/mount.h
===================================================================
RCS file: /home/tedu/cvs/src/sys/sys/mount.h,v
retrieving revision 1.103
diff -u -r1.103 mount.h
--- sys/mount.h 5 Apr 2011 18:51:26 -0000       1.103
+++ sys/mount.h 20 Jun 2011 19:22:34 -0000
@@ -503,7 +503,7 @@
 #define BUFPAGES_INACT (((bcstats.numcleanpages - buflowpages) < 0) ? 0 \
     : bcstats.numcleanpages - buflowpages)
 extern int bufcachepercent;
-extern void bufadjust(int);
+extern void bufadjustpct(void);
 extern int bufbackoff(void);
 
 /*
Index: sys/pipe.h
===================================================================
RCS file: /home/tedu/cvs/src/sys/sys/pipe.h,v
retrieving revision 1.13
diff -u -r1.13 pipe.h
--- sys/pipe.h  21 Nov 2005 18:16:46 -0000      1.13
+++ sys/pipe.h  20 Jun 2011 19:22:34 -0000
@@ -27,7 +27,6 @@
 #ifndef _KERNEL
 #include <sys/time.h>                  /* for struct timeval */
 #include <sys/selinfo.h>                       /* for struct selinfo */
-#include <uvm/uvm_extern.h>            /* for vm_page_t */
 #include <machine/param.h>             /* for PAGE_SIZE */
 #endif /* _KERNEL */
 
Index: sys/user.h
===================================================================
RCS file: /home/tedu/cvs/src/sys/sys/user.h,v
retrieving revision 1.7
diff -u -r1.7 user.h
--- sys/user.h  29 Jun 2010 20:48:50 -0000      1.7
+++ sys/user.h  20 Jun 2011 19:22:34 -0000
@@ -42,8 +42,6 @@
 #include <sys/uio.h>
 #endif
 #include <sys/resourcevar.h>
-#include <uvm/uvm_extern.h>            /* XXX */
-#include <sys/sysctl.h>
 
 
 /*
Index: sys/vnode.h
===================================================================
RCS file: /home/tedu/cvs/src/sys/sys/vnode.h,v
retrieving revision 1.109
diff -u -r1.109 vnode.h
--- sys/vnode.h 5 Apr 2011 14:34:16 -0000       1.109
+++ sys/vnode.h 20 Jun 2011 19:23:55 -0000
@@ -40,7 +40,7 @@
 #include <sys/selinfo.h>
 #include <sys/tree.h>
 
-#include <uvm/uvm.h>
+#include <uvm/uvm_extern.h>
 #include <uvm/uvm_vnode.h>
 
 /*

Reply via email to