svn commit: r251455 - in stable/8/sys: amd64/include arm/include dev/md dev/null i386/include ia64/include mips/include powerpc/include sparc64/include sun4v/include sys vm
Steven Hartland
smh at FreeBSD.org
Thu Jun 6 09:13:10 UTC 2013
Author: smh
Date: Thu Jun 6 09:13:07 2013
New Revision: 251455
URL: http://svnweb.freebsd.org/changeset/base/251455
Log:
MFC r221855:
Move the ZERO_REGION_SIZE to a machine-dependent
Modified:
stable/8/sys/amd64/include/vmparam.h
stable/8/sys/arm/include/vmparam.h
stable/8/sys/dev/md/md.c
stable/8/sys/dev/null/null.c
stable/8/sys/i386/include/vmparam.h
stable/8/sys/ia64/include/vmparam.h
stable/8/sys/mips/include/vmparam.h
stable/8/sys/powerpc/include/vmparam.h
stable/8/sys/sparc64/include/vmparam.h
stable/8/sys/sun4v/include/vmparam.h
stable/8/sys/sys/systm.h
stable/8/sys/vm/vm_kern.c
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/ (props changed)
stable/8/sys/arm/ (props changed)
stable/8/sys/dev/ (props changed)
stable/8/sys/dev/md/ (props changed)
stable/8/sys/dev/null/ (props changed)
stable/8/sys/i386/ (props changed)
stable/8/sys/ia64/ (props changed)
stable/8/sys/mips/ (props changed)
stable/8/sys/powerpc/ (props changed)
stable/8/sys/sparc64/ (props changed)
stable/8/sys/sun4v/ (props changed)
stable/8/sys/sys/ (props changed)
stable/8/sys/vm/ (props changed)
Modified: stable/8/sys/amd64/include/vmparam.h
==============================================================================
--- stable/8/sys/amd64/include/vmparam.h Thu Jun 6 08:57:32 2013 (r251454)
+++ stable/8/sys/amd64/include/vmparam.h Thu Jun 6 09:13:07 2013 (r251455)
@@ -210,4 +210,6 @@
#define VM_INITIAL_PAGEIN 16
#endif
+#define ZERO_REGION_SIZE (2 * 1024 * 1024) /* 2MB */
+
#endif /* _MACHINE_VMPARAM_H_ */
Modified: stable/8/sys/arm/include/vmparam.h
==============================================================================
--- stable/8/sys/arm/include/vmparam.h Thu Jun 6 08:57:32 2013 (r251454)
+++ stable/8/sys/arm/include/vmparam.h Thu Jun 6 09:13:07 2013 (r251455)
@@ -144,4 +144,7 @@
#ifdef ARM_USE_SMALL_ALLOC
#define UMA_MD_SMALL_ALLOC
#endif /* ARM_USE_SMALL_ALLOC */
+
+#define ZERO_REGION_SIZE (64 * 1024) /* 64KB */
+
#endif /* _MACHINE_VMPARAM_H_ */
Modified: stable/8/sys/dev/md/md.c
==============================================================================
--- stable/8/sys/dev/md/md.c Thu Jun 6 08:57:32 2013 (r251454)
+++ stable/8/sys/dev/md/md.c Thu Jun 6 09:13:07 2013 (r251455)
@@ -89,6 +89,8 @@
#include <vm/swap_pager.h>
#include <vm/uma.h>
+#include <machine/vmparam.h>
+
#define MD_MODVER 1
#define MD_SHUTDOWN 0x10000 /* Tell worker thread to terminate. */
Modified: stable/8/sys/dev/null/null.c
==============================================================================
--- stable/8/sys/dev/null/null.c Thu Jun 6 08:57:32 2013 (r251454)
+++ stable/8/sys/dev/null/null.c Thu Jun 6 09:13:07 2013 (r251455)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <sys/filio.h>
#include <machine/bus.h>
+#include <machine/vmparam.h>
/* For use with destroy_dev(9). */
static struct cdev *null_dev;
Modified: stable/8/sys/i386/include/vmparam.h
==============================================================================
--- stable/8/sys/i386/include/vmparam.h Thu Jun 6 08:57:32 2013 (r251454)
+++ stable/8/sys/i386/include/vmparam.h Thu Jun 6 09:13:07 2013 (r251455)
@@ -202,4 +202,6 @@
#define VM_INITIAL_PAGEIN 16
#endif
+#define ZERO_REGION_SIZE (64 * 1024) /* 64KB */
+
#endif /* _MACHINE_VMPARAM_H_ */
Modified: stable/8/sys/ia64/include/vmparam.h
==============================================================================
--- stable/8/sys/ia64/include/vmparam.h Thu Jun 6 08:57:32 2013 (r251454)
+++ stable/8/sys/ia64/include/vmparam.h Thu Jun 6 09:13:07 2013 (r251455)
@@ -181,4 +181,6 @@
#define VM_INITIAL_PAGEIN 16
#endif
+#define ZERO_REGION_SIZE (2 * 1024 * 1024) /* 2MB */
+
#endif /* !_MACHINE_VMPARAM_H_ */
Modified: stable/8/sys/mips/include/vmparam.h
==============================================================================
--- stable/8/sys/mips/include/vmparam.h Thu Jun 6 08:57:32 2013 (r251454)
+++ stable/8/sys/mips/include/vmparam.h Thu Jun 6 09:13:07 2013 (r251455)
@@ -202,4 +202,6 @@
*/
#define VM_NFREEORDER 9
+#define ZERO_REGION_SIZE (64 * 1024) /* 64KB */
+
#endif /* !_MACHINE_VMPARAM_H_ */
Modified: stable/8/sys/powerpc/include/vmparam.h
==============================================================================
--- stable/8/sys/powerpc/include/vmparam.h Thu Jun 6 08:57:32 2013 (r251454)
+++ stable/8/sys/powerpc/include/vmparam.h Thu Jun 6 09:13:07 2013 (r251455)
@@ -182,4 +182,6 @@ struct pmap_physseg {
#define VM_KMEM_SIZE (12 * 1024 * 1024)
#endif
+#define ZERO_REGION_SIZE (64 * 1024) /* 64KB */
+
#endif /* _MACHINE_VMPARAM_H_ */
Modified: stable/8/sys/sparc64/include/vmparam.h
==============================================================================
--- stable/8/sys/sparc64/include/vmparam.h Thu Jun 6 08:57:32 2013 (r251454)
+++ stable/8/sys/sparc64/include/vmparam.h Thu Jun 6 09:13:07 2013 (r251455)
@@ -245,4 +245,11 @@
extern u_int tsb_kernel_ldd_phys;
extern vm_offset_t vm_max_kernel_address;
+/*
+ * Older sparc64 machines have a virtually indexed L1 data cache of 16KB.
+ * Consequently, mapping the same physical page multiple times may have
+ * caching disabled.
+ */
+#define ZERO_REGION_SIZE PAGE_SIZE
+
#endif /* !_MACHINE_VMPARAM_H_ */
Modified: stable/8/sys/sun4v/include/vmparam.h
==============================================================================
--- stable/8/sys/sun4v/include/vmparam.h Thu Jun 6 08:57:32 2013 (r251454)
+++ stable/8/sys/sun4v/include/vmparam.h Thu Jun 6 09:13:07 2013 (r251455)
@@ -227,4 +227,6 @@
#define UMA_MD_SMALL_ALLOC
extern vm_offset_t vm_max_kernel_address;
+#define ZERO_REGION_SIZE (64 * 1024) /* 64KB */
+
#endif /* !_MACHINE_VMPARAM_H_ */
Modified: stable/8/sys/sys/systm.h
==============================================================================
--- stable/8/sys/sys/systm.h Thu Jun 6 08:57:32 2013 (r251454)
+++ stable/8/sys/sys/systm.h Thu Jun 6 09:13:07 2013 (r251455)
@@ -137,7 +137,6 @@ extern char static_hints[]; /* by config
extern char **kenvp;
extern const void *zero_region; /* address space maps to a zeroed page */
-#define ZERO_REGION_SIZE (2048 * 1024)
/*
* General function declarations.
Modified: stable/8/sys/vm/vm_kern.c
==============================================================================
--- stable/8/sys/vm/vm_kern.c Thu Jun 6 08:57:32 2013 (r251454)
+++ stable/8/sys/vm/vm_kern.c Thu Jun 6 09:13:07 2013 (r251455)
@@ -525,25 +525,22 @@ kmem_free_wakeup(map, addr, size)
static void
kmem_init_zero_region(void)
{
- vm_offset_t addr;
+ vm_offset_t addr, i;
vm_page_t m;
- unsigned int i;
int error;
- /* Allocate virtual address space. */
+ /*
+ * Map a single physical page of zeros to a larger virtual range.
+ * This requires less looping in places that want large amounts of
+ * zeros, while not using much more physical resources.
+ */
addr = kmem_alloc_nofault(kernel_map, ZERO_REGION_SIZE);
-
- /* Allocate a page and zero it. */
m = vm_page_alloc(NULL, OFF_TO_IDX(addr - VM_MIN_KERNEL_ADDRESS),
VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO);
if ((m->flags & PG_ZERO) == 0)
pmap_zero_page(m);
-
- /* Map the address space to the page. */
for (i = 0; i < ZERO_REGION_SIZE; i += PAGE_SIZE)
pmap_qenter(addr + i, &m, 1);
-
- /* Protect it r/o. */
error = vm_map_protect(kernel_map, addr, addr + ZERO_REGION_SIZE,
VM_PROT_READ, TRUE);
KASSERT(error == 0, ("error=%d", error));
More information about the svn-src-all
mailing list