Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 May 2011 20:58:48 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r221858 - in projects/largeSMP: bin/chmod bin/ls contrib/top lib/libc/sys share/man/man3 share/mk sys/amd64/include sys/arm/arm sys/arm/include sys/dev/md sys/dev/null sys/i386/include ...
Message-ID:  <201105132058.p4DKwmX9082282@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Fri May 13 20:58:48 2011
New Revision: 221858
URL: http://svn.freebsd.org/changeset/base/221858

Log:
  MFC

Modified:
  projects/largeSMP/bin/chmod/chmod.1
  projects/largeSMP/bin/ls/ls.1
  projects/largeSMP/lib/libc/sys/chmod.2
  projects/largeSMP/lib/libc/sys/stat.2
  projects/largeSMP/share/man/man3/Makefile
  projects/largeSMP/share/man/man3/queue.3
  projects/largeSMP/sys/amd64/include/vmparam.h
  projects/largeSMP/sys/arm/arm/pmap.c
  projects/largeSMP/sys/arm/include/vmparam.h
  projects/largeSMP/sys/dev/md/md.c
  projects/largeSMP/sys/dev/null/null.c
  projects/largeSMP/sys/i386/include/vmparam.h
  projects/largeSMP/sys/ia64/include/vmparam.h
  projects/largeSMP/sys/mips/include/vmparam.h
  projects/largeSMP/sys/powerpc/include/vmparam.h
  projects/largeSMP/sys/sparc64/include/vmparam.h
  projects/largeSMP/sys/sun4v/include/vmparam.h
  projects/largeSMP/sys/sys/queue.h
  projects/largeSMP/sys/sys/systm.h
  projects/largeSMP/sys/vm/vm_kern.c
  projects/largeSMP/tools/tools/nanobsd/nanobsd.sh
Directory Properties:
  projects/largeSMP/   (props changed)
  projects/largeSMP/cddl/contrib/opensolaris/   (props changed)
  projects/largeSMP/contrib/bind9/   (props changed)
  projects/largeSMP/contrib/binutils/   (props changed)
  projects/largeSMP/contrib/bzip2/   (props changed)
  projects/largeSMP/contrib/dialog/   (props changed)
  projects/largeSMP/contrib/ee/   (props changed)
  projects/largeSMP/contrib/expat/   (props changed)
  projects/largeSMP/contrib/file/   (props changed)
  projects/largeSMP/contrib/gcc/   (props changed)
  projects/largeSMP/contrib/gdb/   (props changed)
  projects/largeSMP/contrib/gdtoa/   (props changed)
  projects/largeSMP/contrib/gnu-sort/   (props changed)
  projects/largeSMP/contrib/groff/   (props changed)
  projects/largeSMP/contrib/less/   (props changed)
  projects/largeSMP/contrib/libpcap/   (props changed)
  projects/largeSMP/contrib/libstdc++/   (props changed)
  projects/largeSMP/contrib/llvm/   (props changed)
  projects/largeSMP/contrib/llvm/tools/clang/   (props changed)
  projects/largeSMP/contrib/ncurses/   (props changed)
  projects/largeSMP/contrib/netcat/   (props changed)
  projects/largeSMP/contrib/ntp/   (props changed)
  projects/largeSMP/contrib/one-true-awk/   (props changed)
  projects/largeSMP/contrib/openbsm/   (props changed)
  projects/largeSMP/contrib/openpam/   (props changed)
  projects/largeSMP/contrib/pf/   (props changed)
  projects/largeSMP/contrib/sendmail/   (props changed)
  projects/largeSMP/contrib/tcpdump/   (props changed)
  projects/largeSMP/contrib/tcsh/   (props changed)
  projects/largeSMP/contrib/top/   (props changed)
  projects/largeSMP/contrib/top/install-sh   (props changed)
  projects/largeSMP/contrib/tzcode/stdtime/   (props changed)
  projects/largeSMP/contrib/tzcode/zic/   (props changed)
  projects/largeSMP/contrib/tzdata/   (props changed)
  projects/largeSMP/contrib/wpa/   (props changed)
  projects/largeSMP/contrib/xz/   (props changed)
  projects/largeSMP/crypto/openssh/   (props changed)
  projects/largeSMP/crypto/openssl/   (props changed)
  projects/largeSMP/gnu/lib/   (props changed)
  projects/largeSMP/gnu/usr.bin/binutils/   (props changed)
  projects/largeSMP/gnu/usr.bin/cc/cc_tools/   (props changed)
  projects/largeSMP/gnu/usr.bin/gdb/   (props changed)
  projects/largeSMP/lib/libc/   (props changed)
  projects/largeSMP/lib/libc/stdtime/   (props changed)
  projects/largeSMP/lib/libutil/   (props changed)
  projects/largeSMP/lib/libz/   (props changed)
  projects/largeSMP/sbin/   (props changed)
  projects/largeSMP/sbin/ipfw/   (props changed)
  projects/largeSMP/share/mk/bsd.arch.inc.mk   (props changed)
  projects/largeSMP/share/zoneinfo/   (props changed)
  projects/largeSMP/sys/   (props changed)
  projects/largeSMP/sys/amd64/include/xen/   (props changed)
  projects/largeSMP/sys/boot/   (props changed)
  projects/largeSMP/sys/boot/i386/efi/   (props changed)
  projects/largeSMP/sys/boot/ia64/efi/   (props changed)
  projects/largeSMP/sys/boot/ia64/ski/   (props changed)
  projects/largeSMP/sys/boot/powerpc/boot1.chrp/   (props changed)
  projects/largeSMP/sys/boot/powerpc/ofw/   (props changed)
  projects/largeSMP/sys/cddl/contrib/opensolaris/   (props changed)
  projects/largeSMP/sys/conf/   (props changed)
  projects/largeSMP/sys/contrib/dev/acpica/   (props changed)
  projects/largeSMP/sys/contrib/octeon-sdk/   (props changed)
  projects/largeSMP/sys/contrib/pf/   (props changed)
  projects/largeSMP/sys/contrib/x86emu/   (props changed)
  projects/largeSMP/usr.bin/calendar/   (props changed)
  projects/largeSMP/usr.bin/csup/   (props changed)
  projects/largeSMP/usr.bin/procstat/   (props changed)
  projects/largeSMP/usr.sbin/ndiscvt/   (props changed)
  projects/largeSMP/usr.sbin/zic/   (props changed)

Modified: projects/largeSMP/bin/chmod/chmod.1
==============================================================================
--- projects/largeSMP/bin/chmod/chmod.1	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/bin/chmod/chmod.1	Fri May 13 20:58:48 2011	(r221858)
@@ -134,7 +134,7 @@ will run with effective gid set to the g
 See
 .Xr chmod 2
 and
-.Xr sticky 8 .
+.Xr sticky 7 .
 .It Li 0400
 Allow read by owner.
 .It Li 0200
@@ -325,10 +325,10 @@ option is non-standard and its use in sc
 .Xr umask 2 ,
 .Xr fts 3 ,
 .Xr setmode 3 ,
+.Xr sticky 7 ,
 .Xr symlink 7 ,
 .Xr chown 8 ,
-.Xr mount 8 ,
-.Xr sticky 8
+.Xr mount 8
 .Sh STANDARDS
 The
 .Nm

Modified: projects/largeSMP/bin/ls/ls.1
==============================================================================
--- projects/largeSMP/bin/ls/ls.1	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/bin/ls/ls.1	Fri May 13 20:58:48 2011	(r221858)
@@ -459,7 +459,7 @@ but not execute or search permission.
 (See
 .Xr chmod 1
 or
-.Xr sticky 8 . )
+.Xr sticky 7 . )
 .It Sy t
 The sticky bit is set (mode
 .Li 1000 ) ,
@@ -467,7 +467,7 @@ and is searchable or executable.
 (See
 .Xr chmod 1
 or
-.Xr sticky 8 . )
+.Xr sticky 7 . )
 .El
 .El
 .Pp
@@ -683,9 +683,9 @@ specification.
 .Xr strmode 3 ,
 .Xr termcap 5 ,
 .Xr maclabel 7 ,
+.Xr sticky 7 ,
 .Xr symlink 7 ,
-.Xr getfmac 8 ,
-.Xr sticky 8
+.Xr getfmac 8
 .Sh STANDARDS
 With the exception of options
 .Fl I , g , n

Modified: projects/largeSMP/lib/libc/sys/chmod.2
==============================================================================
--- projects/largeSMP/lib/libc/sys/chmod.2	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/lib/libc/sys/chmod.2	Fri May 13 20:58:48 2011	(r221858)
@@ -161,7 +161,7 @@ The sticky bit may be
 set by any user on a directory which the user owns or has appropriate
 permissions.
 For more details of the properties of the sticky bit, see
-.Xr sticky 8 .
+.Xr sticky 7 .
 .Pp
 If mode ISUID (set UID) is set on a directory,
 and the MNT_SUIDDIR option was used in the mount of the file system,
@@ -289,7 +289,7 @@ nor a file descriptor associated with a 
 .Xr chown 2 ,
 .Xr open 2 ,
 .Xr stat 2 ,
-.Xr sticky 8
+.Xr sticky 7
 .Sh STANDARDS
 The
 .Fn chmod

Modified: projects/largeSMP/lib/libc/sys/stat.2
==============================================================================
--- projects/largeSMP/lib/libc/sys/stat.2	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/lib/libc/sys/stat.2	Fri May 13 20:58:48 2011	(r221858)
@@ -401,8 +401,8 @@ nor a file descriptor associated with a 
 .Xr fhstat 2 ,
 .Xr statfs 2 ,
 .Xr utimes 2 ,
-.Xr symlink 7 ,
-.Xr sticky 8
+.Xr sticky 7 ,
+.Xr symlink 7
 .Sh STANDARDS
 The
 .Fn stat

Modified: projects/largeSMP/share/man/man3/Makefile
==============================================================================
--- projects/largeSMP/share/man/man3/Makefile	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/share/man/man3/Makefile	Fri May 13 20:58:48 2011	(r221858)
@@ -53,6 +53,7 @@ MLINKS+=	queue.3 LIST_EMPTY.3 \
 		queue.3 LIST_INSERT_HEAD.3 \
 		queue.3 LIST_NEXT.3 \
 		queue.3 LIST_REMOVE.3 \
+		queue.3 LIST_SWAP.3 \
 		queue.3 SLIST_EMPTY.3 \
 		queue.3 SLIST_ENTRY.3 \
 		queue.3 SLIST_FIRST.3 \
@@ -67,6 +68,7 @@ MLINKS+=	queue.3 LIST_EMPTY.3 \
 		queue.3 SLIST_REMOVE.3 \
 		queue.3 SLIST_REMOVE_AFTER.3 \
 		queue.3 SLIST_REMOVE_HEAD.3 \
+		queue.3 SLIST_SWAP.3 \
 		queue.3 STAILQ_CONCAT.3 \
 		queue.3 STAILQ_EMPTY.3 \
 		queue.3 STAILQ_ENTRY.3 \
@@ -84,6 +86,7 @@ MLINKS+=	queue.3 LIST_EMPTY.3 \
 		queue.3 STAILQ_REMOVE.3 \
 		queue.3 STAILQ_REMOVE_AFTER.3 \
 		queue.3 STAILQ_REMOVE_HEAD.3 \
+		queue.3 STAILQ_SWAP.3 \
 		queue.3 TAILQ_CONCAT.3 \
 		queue.3 TAILQ_EMPTY.3 \
 		queue.3 TAILQ_ENTRY.3 \
@@ -102,7 +105,8 @@ MLINKS+=	queue.3 LIST_EMPTY.3 \
 		queue.3 TAILQ_LAST.3 \
 		queue.3 TAILQ_NEXT.3 \
 		queue.3 TAILQ_PREV.3 \
-		queue.3 TAILQ_REMOVE.3
+		queue.3 TAILQ_REMOVE.3 \
+		queue.3 TAILQ_SWAP.3
 MLINKS+=	stdarg.3 va_arg.3 \
 		stdarg.3 va_copy.3 \
 		stdarg.3 va_end.3 \

Modified: projects/largeSMP/share/man/man3/queue.3
==============================================================================
--- projects/largeSMP/share/man/man3/queue.3	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/share/man/man3/queue.3	Fri May 13 20:58:48 2011	(r221858)
@@ -32,7 +32,7 @@
 .\"	@(#)queue.3	8.2 (Berkeley) 1/24/94
 .\" $FreeBSD$
 .\"
-.Dd March 24, 2006
+.Dd May 13, 2011
 .Dt QUEUE 3
 .Os
 .Sh NAME
@@ -50,6 +50,7 @@
 .Nm SLIST_REMOVE_AFTER ,
 .Nm SLIST_REMOVE_HEAD ,
 .Nm SLIST_REMOVE ,
+.Nm SLIST_SWAP ,
 .Nm STAILQ_CONCAT ,
 .Nm STAILQ_EMPTY ,
 .Nm STAILQ_ENTRY ,
@@ -67,6 +68,7 @@
 .Nm STAILQ_REMOVE_AFTER ,
 .Nm STAILQ_REMOVE_HEAD ,
 .Nm STAILQ_REMOVE ,
+.Nm STAILQ_SWAP ,
 .Nm LIST_EMPTY ,
 .Nm LIST_ENTRY ,
 .Nm LIST_FIRST ,
@@ -80,6 +82,7 @@
 .Nm LIST_INSERT_HEAD ,
 .Nm LIST_NEXT ,
 .Nm LIST_REMOVE ,
+.Nm LIST_SWAP ,
 .Nm TAILQ_CONCAT ,
 .Nm TAILQ_EMPTY ,
 .Nm TAILQ_ENTRY ,
@@ -98,7 +101,8 @@
 .Nm TAILQ_LAST ,
 .Nm TAILQ_NEXT ,
 .Nm TAILQ_PREV ,
-.Nm TAILQ_REMOVE
+.Nm TAILQ_REMOVE ,
+.Nm TAILQ_SWAP
 .Nd implementations of singly-linked lists, singly-linked tail queues,
 lists and tail queues
 .Sh SYNOPSIS
@@ -118,6 +122,7 @@ lists and tail queues
 .Fn SLIST_REMOVE_AFTER "TYPE *elm" "SLIST_ENTRY NAME"
 .Fn SLIST_REMOVE_HEAD "SLIST_HEAD *head" "SLIST_ENTRY NAME"
 .Fn SLIST_REMOVE "SLIST_HEAD *head" "TYPE *elm" "TYPE" "SLIST_ENTRY NAME"
+.Fn SLIST_SWAP "SLIST_HEAD *head1" "SLIST_HEAD *head2" "SLIST_ENTRY NAME"
 .\"
 .Fn STAILQ_CONCAT "STAILQ_HEAD *head1" "STAILQ_HEAD *head2"
 .Fn STAILQ_EMPTY "STAILQ_HEAD *head"
@@ -136,6 +141,7 @@ lists and tail queues
 .Fn STAILQ_REMOVE_AFTER "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME"
 .Fn STAILQ_REMOVE_HEAD "STAILQ_HEAD *head" "STAILQ_ENTRY NAME"
 .Fn STAILQ_REMOVE "STAILQ_HEAD *head" "TYPE *elm" "TYPE" "STAILQ_ENTRY NAME"
+.Fn STAILQ_SWAP "STAILQ_HEAD *head1" "STAILQ_HEAD *head2" "STAILQ_ENTRY NAME"
 .\"
 .Fn LIST_EMPTY "LIST_HEAD *head"
 .Fn LIST_ENTRY "TYPE"
@@ -150,6 +156,7 @@ lists and tail queues
 .Fn LIST_INSERT_HEAD "LIST_HEAD *head" "TYPE *elm" "LIST_ENTRY NAME"
 .Fn LIST_NEXT "TYPE *elm" "LIST_ENTRY NAME"
 .Fn LIST_REMOVE "TYPE *elm" "LIST_ENTRY NAME"
+.Fn LIST_SWAP "LIST_HEAD *head1" "LIST_HEAD *head2" "TYPE" "LIST_ENTRY NAME"
 .\"
 .Fn TAILQ_CONCAT "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TAILQ_ENTRY NAME"
 .Fn TAILQ_EMPTY "TAILQ_HEAD *head"
@@ -170,6 +177,7 @@ lists and tail queues
 .Fn TAILQ_NEXT "TYPE *elm" "TAILQ_ENTRY NAME"
 .Fn TAILQ_PREV "TYPE *elm" "HEADNAME" "TAILQ_ENTRY NAME"
 .Fn TAILQ_REMOVE "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME"
+.Fn TAILQ_SWAP "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TYPE" "TAILQ_ENTRY NAME"
 .\"
 .Sh DESCRIPTION
 These macros define and operate on four types of data structures:
@@ -184,6 +192,8 @@ Insertion of a new entry after any eleme
 O(1) removal of an entry from the head of the list.
 .It
 Forward traversal through the list.
+.It
+Swawpping the contents of two lists.
 .El
 .Pp
 Singly-linked lists are the simplest of the four data structures
@@ -402,6 +412,13 @@ The macro
 removes the element
 .Fa elm
 from the list.
+.Pp
+The macro
+.Nm SLIST_SWAP
+swaps the contents of
+.Fa head1
+and
+.Fa head2 .
 .Sh SINGLY-LINKED LIST EXAMPLE
 .Bd -literal
 SLIST_HEAD(slisthead, entry) head =
@@ -584,6 +601,13 @@ The macro
 removes the element
 .Fa elm
 from the tail queue.
+.Pp
+The macro
+.Nm STAILQ_SWAP
+swaps the contents of
+.Fa head1
+and
+.Fa head2 .
 .Sh SINGLY-LINKED TAIL QUEUE EXAMPLE
 .Bd -literal
 STAILQ_HEAD(stailhead, entry) head =
@@ -743,6 +767,13 @@ The macro
 removes the element
 .Fa elm
 from the list.
+.Pp
+The macro
+.Nm LIST_SWAP
+swaps the contents of
+.Fa head1
+and
+.Fa head2 .
 .Sh LIST EXAMPLE
 .Bd -literal
 LIST_HEAD(listhead, entry) head =
@@ -942,6 +973,13 @@ The macro
 removes the element
 .Fa elm
 from the tail queue.
+.Pp
+The macro
+.Nm TAILQ_SWAP
+swaps the contents of
+.Fa head1
+and
+.Fa head2 .
 .Sh TAIL QUEUE EXAMPLE
 .Bd -literal
 TAILQ_HEAD(tailhead, entry) head =

Modified: projects/largeSMP/sys/amd64/include/vmparam.h
==============================================================================
--- projects/largeSMP/sys/amd64/include/vmparam.h	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/sys/amd64/include/vmparam.h	Fri May 13 20:58:48 2011	(r221858)
@@ -212,4 +212,6 @@
 #define	VM_INITIAL_PAGEIN	16
 #endif
 
+#define	ZERO_REGION_SIZE	(2 * 1024 * 1024)	/* 2MB */
+
 #endif /* _MACHINE_VMPARAM_H_ */

Modified: projects/largeSMP/sys/arm/arm/pmap.c
==============================================================================
--- projects/largeSMP/sys/arm/arm/pmap.c	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/sys/arm/arm/pmap.c	Fri May 13 20:58:48 2011	(r221858)
@@ -3646,7 +3646,7 @@ pmap_change_wiring(pmap_t pmap, vm_offse
 	pte = *ptep;
 	pg = PHYS_TO_VM_PAGE(l2pte_pa(pte));
 	if (pg) 
-		pmap_modify_pv(pg, pmap, va, PVF_WIRED, wired);
+		pmap_modify_pv(pg, pmap, va, PVF_WIRED, wired ? PVF_WIRED : 0);
 	vm_page_unlock_queues();
  	PMAP_UNLOCK(pmap);
 }

Modified: projects/largeSMP/sys/arm/include/vmparam.h
==============================================================================
--- projects/largeSMP/sys/arm/include/vmparam.h	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/sys/arm/include/vmparam.h	Fri May 13 20:58:48 2011	(r221858)
@@ -150,4 +150,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: projects/largeSMP/sys/dev/md/md.c
==============================================================================
--- projects/largeSMP/sys/dev/md/md.c	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/sys/dev/md/md.c	Fri May 13 20:58:48 2011	(r221858)
@@ -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. */
@@ -205,9 +207,6 @@ struct md_s {
 	vm_object_t object;
 };
 
-/* Used for BIO_DELETE on MD_VNODE */
-static u_char zero[PAGE_SIZE];
-
 static struct indir *
 new_indir(u_int shift)
 {
@@ -560,7 +559,8 @@ mdstart_vnode(struct md_s *sc, struct bi
 	 * that the two cases end up having very little in common.
 	 */
 	if (bp->bio_cmd == BIO_DELETE) {
-		zerosize = sizeof(zero) - (sizeof(zero) % sc->sectorsize);
+		zerosize = ZERO_REGION_SIZE -
+		    (ZERO_REGION_SIZE % sc->sectorsize);
 		auio.uio_iov = &aiov;
 		auio.uio_iovcnt = 1;
 		auio.uio_offset = (vm_ooffset_t)bp->bio_offset;
@@ -573,7 +573,7 @@ mdstart_vnode(struct md_s *sc, struct bi
 		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 		error = 0;
 		while (auio.uio_offset < end) {
-			aiov.iov_base = zero;
+			aiov.iov_base = __DECONST(void *, zero_region);
 			aiov.iov_len = end - auio.uio_offset;
 			if (aiov.iov_len > zerosize)
 				aiov.iov_len = zerosize;

Modified: projects/largeSMP/sys/dev/null/null.c
==============================================================================
--- projects/largeSMP/sys/dev/null/null.c	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/sys/dev/null/null.c	Fri May 13 20:58:48 2011	(r221858)
@@ -39,7 +39,9 @@ __FBSDID("$FreeBSD$");
 #include <sys/priv.h>
 #include <sys/disk.h>
 #include <sys/bus.h>
+
 #include <machine/bus.h>
+#include <machine/vmparam.h>
 
 /* For use with destroy_dev(9). */
 static struct cdev *null_dev;
@@ -65,8 +67,6 @@ static struct cdevsw zero_cdevsw = {
 	.d_flags =	D_MMAP_ANON,
 };
 
-static void *zbuf;
-
 /* ARGSUSED */
 static int
 null_write(struct cdev *dev __unused, struct uio *uio, int flags __unused)
@@ -95,10 +95,19 @@ null_ioctl(struct cdev *dev __unused, u_
 static int
 zero_read(struct cdev *dev __unused, struct uio *uio, int flags __unused)
 {
+	void *zbuf;
+	ssize_t len;
 	int error = 0;
 
-	while (uio->uio_resid > 0 && error == 0)
-		error = uiomove(zbuf, MIN(uio->uio_resid, PAGE_SIZE), uio);
+	KASSERT(uio->uio_rw == UIO_READ,
+	    ("Can't be in %s for write", __func__));
+	zbuf = __DECONST(void *, zero_region);
+	while (uio->uio_resid > 0 && error == 0) {
+		len = uio->uio_resid;
+		if (len > ZERO_REGION_SIZE)
+			len = ZERO_REGION_SIZE;
+		error = uiomove(zbuf, len, uio);
+	}
 
 	return (error);
 }
@@ -111,7 +120,6 @@ null_modevent(module_t mod __unused, int
 	case MOD_LOAD:
 		if (bootverbose)
 			printf("null: <null device, zero device>\n");
-		zbuf = (void *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO);
 		null_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, &null_cdevsw, 0,
 		    NULL, UID_ROOT, GID_WHEEL, 0666, "null");
 		zero_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, &zero_cdevsw, 0,
@@ -121,7 +129,6 @@ null_modevent(module_t mod __unused, int
 	case MOD_UNLOAD:
 		destroy_dev(null_dev);
 		destroy_dev(zero_dev);
-		free(zbuf, M_TEMP);
 		break;
 
 	case MOD_SHUTDOWN:

Modified: projects/largeSMP/sys/i386/include/vmparam.h
==============================================================================
--- projects/largeSMP/sys/i386/include/vmparam.h	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/sys/i386/include/vmparam.h	Fri May 13 20:58:48 2011	(r221858)
@@ -198,4 +198,6 @@
 #define	VM_INITIAL_PAGEIN	16
 #endif
 
+#define	ZERO_REGION_SIZE	(64 * 1024)	/* 64KB */
+
 #endif /* _MACHINE_VMPARAM_H_ */

Modified: projects/largeSMP/sys/ia64/include/vmparam.h
==============================================================================
--- projects/largeSMP/sys/ia64/include/vmparam.h	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/sys/ia64/include/vmparam.h	Fri May 13 20:58:48 2011	(r221858)
@@ -215,4 +215,6 @@
 #define	VM_INITIAL_PAGEIN	16
 #endif
 
+#define	ZERO_REGION_SIZE	(2 * 1024 * 1024)	/* 2MB */
+
 #endif	/* !_MACHINE_VMPARAM_H_ */

Modified: projects/largeSMP/sys/mips/include/vmparam.h
==============================================================================
--- projects/largeSMP/sys/mips/include/vmparam.h	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/sys/mips/include/vmparam.h	Fri May 13 20:58:48 2011	(r221858)
@@ -187,4 +187,6 @@
  */
 #define	VM_NFREEORDER		9
 
+#define	ZERO_REGION_SIZE	(64 * 1024)	/* 64KB */
+
 #endif /* !_MACHINE_VMPARAM_H_ */

Modified: projects/largeSMP/sys/powerpc/include/vmparam.h
==============================================================================
--- projects/largeSMP/sys/powerpc/include/vmparam.h	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/sys/powerpc/include/vmparam.h	Fri May 13 20:58:48 2011	(r221858)
@@ -198,4 +198,6 @@ struct pmap_physseg {
 #endif
 #endif
 
+#define	ZERO_REGION_SIZE	(64 * 1024)	/* 64KB */
+
 #endif /* _MACHINE_VMPARAM_H_ */

Modified: projects/largeSMP/sys/sparc64/include/vmparam.h
==============================================================================
--- projects/largeSMP/sys/sparc64/include/vmparam.h	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/sys/sparc64/include/vmparam.h	Fri May 13 20:58:48 2011	(r221858)
@@ -240,4 +240,11 @@
 
 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: projects/largeSMP/sys/sun4v/include/vmparam.h
==============================================================================
--- projects/largeSMP/sys/sun4v/include/vmparam.h	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/sys/sun4v/include/vmparam.h	Fri May 13 20:58:48 2011	(r221858)
@@ -223,4 +223,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: projects/largeSMP/sys/sys/queue.h
==============================================================================
--- projects/largeSMP/sys/sys/queue.h	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/sys/sys/queue.h	Fri May 13 20:58:48 2011	(r221858)
@@ -99,6 +99,7 @@
  * _REMOVE_AFTER		+	-	+	-
  * _REMOVE_HEAD			+	-	+	-
  * _REMOVE			+	+	+	+
+ * _SWAP			+	+	+	+
  *
  */
 #ifdef QUEUE_MACRO_DEBUG
@@ -307,18 +308,18 @@ struct {								\
 	TRASHIT(*oldnext);						\
 } while (0)
 
-#define	STAILQ_REMOVE_HEAD(head, field) do {				\
-	if ((STAILQ_FIRST((head)) =					\
-	     STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL)		\
-		(head)->stqh_last = &STAILQ_FIRST((head));		\
-} while (0)
-
 #define STAILQ_REMOVE_AFTER(head, elm, field) do {			\
 	if ((STAILQ_NEXT(elm, field) =					\
 	     STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL)	\
 		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\
 } while (0)
 
+#define	STAILQ_REMOVE_HEAD(head, field) do {				\
+	if ((STAILQ_FIRST((head)) =					\
+	     STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL)		\
+		(head)->stqh_last = &STAILQ_FIRST((head));		\
+} while (0)
+
 #define STAILQ_SWAP(head1, head2, type) do {				\
 	struct type *swap_first = STAILQ_FIRST(head1);			\
 	struct type **swap_last = (head1)->stqh_last;			\

Modified: projects/largeSMP/sys/sys/systm.h
==============================================================================
--- projects/largeSMP/sys/sys/systm.h	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/sys/sys/systm.h	Fri May 13 20:58:48 2011	(r221858)
@@ -125,6 +125,8 @@ extern char static_hints[];	/* by config
 
 extern char **kenvp;
 
+extern const void *zero_region;	/* address space maps to a zeroed page	*/
+
 /*
  * General function declarations.
  */

Modified: projects/largeSMP/sys/vm/vm_kern.c
==============================================================================
--- projects/largeSMP/sys/vm/vm_kern.c	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/sys/vm/vm_kern.c	Fri May 13 20:58:48 2011	(r221858)
@@ -91,6 +91,9 @@ vm_map_t exec_map=0;
 vm_map_t pipe_map;
 vm_map_t buffer_map=0;
 
+const void *zero_region;
+CTASSERT((ZERO_REGION_SIZE & PAGE_MASK) == 0);
+
 /*
  *	kmem_alloc_nofault:
  *
@@ -527,6 +530,32 @@ kmem_free_wakeup(map, addr, size)
 	vm_map_unlock(map);
 }
 
+static void
+kmem_init_zero_region(void)
+{
+	vm_offset_t addr, i;
+	vm_page_t m;
+	int error;
+
+	/*
+	 * 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);
+	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);
+	for (i = 0; i < ZERO_REGION_SIZE; i += PAGE_SIZE)
+		pmap_qenter(addr + i, &m, 1);
+	error = vm_map_protect(kernel_map, addr, addr + ZERO_REGION_SIZE,
+	    VM_PROT_READ, TRUE);
+	KASSERT(error == 0, ("error=%d", error));
+
+	zero_region = (const void *)addr;
+}
+
 /*
  * 	kmem_init:
  *
@@ -555,6 +584,8 @@ kmem_init(start, end)
 	    start, VM_PROT_ALL, VM_PROT_ALL, MAP_NOFAULT);
 	/* ... and ending with the completion of the above `insert' */
 	vm_map_unlock(m);
+
+	kmem_init_zero_region();
 }
 
 #ifdef DIAGNOSTIC

Modified: projects/largeSMP/tools/tools/nanobsd/nanobsd.sh
==============================================================================
--- projects/largeSMP/tools/tools/nanobsd/nanobsd.sh	Fri May 13 19:56:58 2011	(r221857)
+++ projects/largeSMP/tools/tools/nanobsd/nanobsd.sh	Fri May 13 20:58:48 2011	(r221858)
@@ -418,7 +418,7 @@ populate_slice ( ) (
 	echo "Creating ${dev} with ${dir} (mounting on ${mnt})"
 	newfs_part $dev $mnt $lbl
 	cd ${dir}
-	find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${mnt}
+	find . -print | grep -Ev '/(CVS|\.svn)' | cpio -Ldumpv ${mnt}
 	df -i ${mnt}
 	umount ${mnt}
 )
@@ -567,8 +567,10 @@ create_i386_diskimage ( ) (
 		dd if=/dev/${MD} of=${IMG} bs=64k
 	fi
 
-	echo "Writing out _.disk.image..."
-	dd if=/dev/${MD}s1 of=${NANO_DISKIMGDIR}/_.disk.image bs=64k
+	if ${do_copyout_partition} ; then
+		echo "Writing out _.disk.image..."
+		dd if=/dev/${MD}s1 of=${NANO_DISKIMGDIR}/_.disk.image bs=64k
+	fi
 	mdconfig -d -u $MD
 
 	trap - 1 2 15 EXIT
@@ -674,7 +676,7 @@ cust_allow_ssh_root () (
 
 cust_install_files () (
 	cd ${NANO_TOOLS}/Files
-	find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${NANO_WORLDDIR}
+	find . -print | grep -Ev '/(CVS|\.svn)' | cpio -Ldumpv ${NANO_WORLDDIR}
 )
 
 #######################################################################
@@ -682,12 +684,18 @@ cust_install_files () (
 
 cust_pkg () (
 
+	# If the package directory doesn't exist, we're done.
+	if [ ! -d ${NANO_PACKAGE_DIR} ]; then
+		echo "DONE 0 packages"
+		return 0
+	fi
+
 	# Copy packages into chroot
 	mkdir -p ${NANO_WORLDDIR}/Pkg
 	(
 		cd ${NANO_PACKAGE_DIR}
 		find ${NANO_PACKAGE_LIST} -print |
-		    cpio -dumpv ${NANO_WORLDDIR}/Pkg
+		    cpio -Ldumpv ${NANO_WORLDDIR}/Pkg
 	)
 
 	# Count & report how many we have to install
@@ -758,8 +766,9 @@ pprint() {
 
 usage () {
 	(
-	echo "Usage: $0 [-biknqvw] [-c config_file]"
+	echo "Usage: $0 [-bfiknqvw] [-c config_file]"
 	echo "	-b	suppress builds (both kernel and world)"
+	echo "	-f	suppress code slice extraction"
 	echo "	-i	suppress disk image build"
 	echo "	-k	suppress buildkernel"
 	echo "	-n	add -DNO_CLEAN to buildworld, buildkernel, etc"
@@ -778,9 +787,10 @@ do_clean=true
 do_kernel=true
 do_world=true
 do_image=true
+do_copyout_partition=true
 
 set +e
-args=`getopt bc:hiknqvw $*`
+args=`getopt bc:fhiknqvw $*`
 if [ $? -ne 0 ] ; then
 	usage
 	exit 2
@@ -806,6 +816,10 @@ do
 		shift
 		shift
 		;;
+	-f)
+		do_copyout_partition=false
+		shift
+		;;
 	-h)
 		usage
 		;;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105132058.p4DKwmX9082282>