aboutsummaryrefslogtreecommitdiff
path: root/sys/vm
diff options
context:
space:
mode:
authorAlan Cox <alc@FreeBSD.org>2010-07-25 17:43:38 +0000
committerAlan Cox <alc@FreeBSD.org>2010-07-25 17:43:38 +0000
commit9e4e511499468aa0b9e898fd9bc1a82e924731b7 (patch)
tree84bc9e509fd3ee94e50dcb0812a33b82c1b67b87 /sys/vm
parent8edcf69406cc816bb7c64b51ec38f23d25ad4b67 (diff)
downloadsrc-9e4e511499468aa0b9e898fd9bc1a82e924731b7.tar.gz
src-9e4e511499468aa0b9e898fd9bc1a82e924731b7.zip
Change the order in which the file name, arguments, environment, and
shell command are stored in exec*()'s demand-paged string buffer. For a "buildworld" on an 8GB amd64 multiprocessor, the new order reduces the number of global TLB shootdowns by 31%. It also eliminates about 330k page faults on the kernel address space. Change exec_shell_imgact() to use "args->begin_argv" consistently as the start of the argument and environment strings. Previously, it would sometimes use "args->buf", which is the start of the overall buffer, but no longer the start of the argument and environment strings. While I'm here, eliminate unnecessary passing of "&length" to copystr(), where we don't actually care about the length of the copied string. Clean up the initialization of the exec map. In particular, use the correct size for an entry, and express that size in the same way that is used when an entry is allocated. The old size was one page too large. (This discrepancy originated in 2004 when I rewrote exec_map_first_page() to use sf_buf_alloc() instead of the exec map for mapping the first page of the executable.) Reviewed by: kib
Notes
Notes: svn path=/head/; revision=210475
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_init.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/vm/vm_init.c b/sys/vm/vm_init.c
index fdffb463891d..877593714948 100644
--- a/sys/vm/vm_init.c
+++ b/sys/vm/vm_init.c
@@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/selinfo.h>
+#include <sys/imgact.h>
#include <sys/pipe.h>
#include <sys/bio.h>
#include <sys/buf.h>
@@ -194,7 +195,8 @@ again:
(long)nswbuf * MAXPHYS, FALSE);
pager_map->system_map = 1;
exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
- exec_map_entries * (ARG_MAX + (PAGE_SIZE * 3)), FALSE);
+ exec_map_entries * round_page(PATH_MAX + ARG_MAX + MAXSHELLCMDLEN),
+ FALSE);
pipe_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr, maxpipekva,
FALSE);