From owner-svn-src-stable-9@FreeBSD.ORG Fri Sep 14 14:23:18 2012 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BC88106564A; Fri, 14 Sep 2012 14:23:18 +0000 (UTC) (envelope-from zont@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 75D638FC0C; Fri, 14 Sep 2012 14:23:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8EENIBh039598; Fri, 14 Sep 2012 14:23:18 GMT (envelope-from zont@svn.freebsd.org) Received: (from zont@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8EENISl039595; Fri, 14 Sep 2012 14:23:18 GMT (envelope-from zont@svn.freebsd.org) Message-Id: <201209141423.q8EENISl039595@svn.freebsd.org> From: Andrey Zonov Date: Fri, 14 Sep 2012 14:23:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240501 - in stable/9/sys: kern vm X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Sep 2012 14:23:18 -0000 Author: zont Date: Fri Sep 14 14:23:17 2012 New Revision: 240501 URL: http://svn.freebsd.org/changeset/base/240501 Log: MFC r240026: - Make kern.maxtsiz, kern.dfldsiz, kern.maxdsiz, kern.dflssiz, kern.maxssiz and kern.sgrowsiz sysctls writable. MFC r240068: - Mark some sysctls with CTLFLAG_TUN flag instead of CTLFLAG_RDTUN. MFC r240069: - After r240026 sgrowsiz should be used in a safer maner. Modified: stable/9/sys/kern/subr_param.c stable/9/sys/vm/vm_map.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/subr_param.c ============================================================================== --- stable/9/sys/kern/subr_param.c Fri Sep 14 13:57:34 2012 (r240500) +++ stable/9/sys/kern/subr_param.c Fri Sep 14 14:23:17 2012 (r240501) @@ -119,17 +119,17 @@ SYSCTL_LONG(_kern, OID_AUTO, maxswzone, "Maximum memory for swap metadata"); SYSCTL_LONG(_kern, OID_AUTO, maxbcache, CTLFLAG_RDTUN, &maxbcache, 0, "Maximum value of vfs.maxbufspace"); -SYSCTL_ULONG(_kern, OID_AUTO, maxtsiz, CTLFLAG_RDTUN, &maxtsiz, 0, +SYSCTL_ULONG(_kern, OID_AUTO, maxtsiz, CTLFLAG_RW | CTLFLAG_TUN, &maxtsiz, 0, "Maximum text size"); -SYSCTL_ULONG(_kern, OID_AUTO, dfldsiz, CTLFLAG_RDTUN, &dfldsiz, 0, +SYSCTL_ULONG(_kern, OID_AUTO, dfldsiz, CTLFLAG_RW | CTLFLAG_TUN, &dfldsiz, 0, "Initial data size limit"); -SYSCTL_ULONG(_kern, OID_AUTO, maxdsiz, CTLFLAG_RDTUN, &maxdsiz, 0, +SYSCTL_ULONG(_kern, OID_AUTO, maxdsiz, CTLFLAG_RW | CTLFLAG_TUN, &maxdsiz, 0, "Maximum data size"); -SYSCTL_ULONG(_kern, OID_AUTO, dflssiz, CTLFLAG_RDTUN, &dflssiz, 0, +SYSCTL_ULONG(_kern, OID_AUTO, dflssiz, CTLFLAG_RW | CTLFLAG_TUN, &dflssiz, 0, "Initial stack size limit"); -SYSCTL_ULONG(_kern, OID_AUTO, maxssiz, CTLFLAG_RDTUN, &maxssiz, 0, +SYSCTL_ULONG(_kern, OID_AUTO, maxssiz, CTLFLAG_RW | CTLFLAG_TUN, &maxssiz, 0, "Maximum stack size"); -SYSCTL_ULONG(_kern, OID_AUTO, sgrowsiz, CTLFLAG_RDTUN, &sgrowsiz, 0, +SYSCTL_ULONG(_kern, OID_AUTO, sgrowsiz, CTLFLAG_RW | CTLFLAG_TUN, &sgrowsiz, 0, "Amount to grow stack on a stack fault"); SYSCTL_PROC(_kern, OID_AUTO, vm_guest, CTLFLAG_RD | CTLTYPE_STRING, NULL, 0, sysctl_kern_vm_guest, "A", Modified: stable/9/sys/vm/vm_map.c ============================================================================== --- stable/9/sys/vm/vm_map.c Fri Sep 14 13:57:34 2012 (r240500) +++ stable/9/sys/vm/vm_map.c Fri Sep 14 14:23:17 2012 (r240501) @@ -3245,7 +3245,7 @@ vm_map_stack(vm_map_t map, vm_offset_t a { vm_map_entry_t new_entry, prev_entry; vm_offset_t bot, top; - vm_size_t init_ssize; + vm_size_t growsize, init_ssize; int orient, rv; rlim_t vmemlim; @@ -3264,7 +3264,8 @@ vm_map_stack(vm_map_t map, vm_offset_t a addrbos + max_ssize < addrbos) return (KERN_NO_SPACE); - init_ssize = (max_ssize < sgrowsiz) ? max_ssize : sgrowsiz; + growsize = sgrowsiz; + init_ssize = (max_ssize < growsize) ? max_ssize : growsize; PROC_LOCK(curthread->td_proc); vmemlim = lim_cur(curthread->td_proc, RLIMIT_VMEM); @@ -3357,6 +3358,7 @@ vm_map_growstack(struct proc *p, vm_offs struct vmspace *vm = p->p_vmspace; vm_map_t map = &vm->vm_map; vm_offset_t end; + vm_size_t growsize; size_t grow_amount, max_grow; rlim_t stacklim, vmemlim; int is_procstack, rv; @@ -3476,8 +3478,9 @@ Retry: PROC_UNLOCK(p); #endif - /* Round up the grow amount modulo SGROWSIZ */ - grow_amount = roundup (grow_amount, sgrowsiz); + /* Round up the grow amount modulo sgrowsiz */ + growsize = sgrowsiz; + grow_amount = roundup(grow_amount, growsize); if (grow_amount > stack_entry->avail_ssize) grow_amount = stack_entry->avail_ssize; if (is_procstack && (ctob(vm->vm_ssize) + grow_amount > stacklim)) {