From owner-svn-src-all@FreeBSD.ORG Mon Apr 25 06:36:27 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 426EE1065670; Mon, 25 Apr 2011 06:36:27 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24A738FC16; Mon, 25 Apr 2011 06:36:27 +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 p3P6aRql064400; Mon, 25 Apr 2011 06:36:27 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p3P6aRuU064397; Mon, 25 Apr 2011 06:36:27 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201104250636.p3P6aRuU064397@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 25 Apr 2011 06:36:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221008 - in stable/8: lib/libc/sys sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2011 06:36:27 -0000 Author: pluknet Date: Mon Apr 25 06:36:26 2011 New Revision: 221008 URL: http://svn.freebsd.org/changeset/base/221008 Log: MFC r218989: Remove no more useful sysctl vm.max_proc_mmap, which also fixes mmap(2) overflow seen with over 256GB of physical memory installed. Modified: stable/8/lib/libc/sys/mmap.2 stable/8/sys/vm/vm_mmap.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/lib/libc/sys/mmap.2 ============================================================================== --- stable/8/lib/libc/sys/mmap.2 Mon Apr 25 06:03:22 2011 (r221007) +++ stable/8/lib/libc/sys/mmap.2 Mon Apr 25 06:36:26 2011 (r221008) @@ -329,9 +329,6 @@ was specified and the argument was not available. .Dv MAP_ANON was specified and insufficient memory was available. -The system has reached the per-process mmap limit specified in the -.Va vm.max_proc_mmap -sysctl. .El .Sh SEE ALSO .Xr madvise 2 , Modified: stable/8/sys/vm/vm_mmap.c ============================================================================== --- stable/8/sys/vm/vm_mmap.c Mon Apr 25 06:03:22 2011 (r221007) +++ stable/8/sys/vm/vm_mmap.c Mon Apr 25 06:36:26 2011 (r221008) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -66,7 +65,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include @@ -80,7 +78,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #ifdef HWPMC_HOOKS #include @@ -92,30 +89,6 @@ struct sbrk_args { }; #endif -static int max_proc_mmap; -SYSCTL_INT(_vm, OID_AUTO, max_proc_mmap, CTLFLAG_RW, &max_proc_mmap, 0, - "Maximum number of memory-mapped files per process"); - -/* - * Set the maximum number of vm_map_entry structures per process. Roughly - * speaking vm_map_entry structures are tiny, so allowing them to eat 1/100 - * of our KVM malloc space still results in generous limits. We want a - * default that is good enough to prevent the kernel running out of resources - * if attacked from compromised user account but generous enough such that - * multi-threaded processes are not unduly inconvenienced. - */ -static void vmmapentry_rsrc_init(void *); -SYSINIT(vmmersrc, SI_SUB_KVM_RSRC, SI_ORDER_FIRST, vmmapentry_rsrc_init, - NULL); - -static void -vmmapentry_rsrc_init(dummy) - void *dummy; -{ - max_proc_mmap = vm_kmem_size / sizeof(struct vm_map_entry); - max_proc_mmap /= 100; -} - static int vm_mmap_vnode(struct thread *, vm_size_t, vm_prot_t, vm_prot_t *, int *, struct vnode *, vm_ooffset_t *, vm_object_t *); static int vm_mmap_cdev(struct thread *, vm_size_t, vm_prot_t, vm_prot_t *, @@ -375,18 +348,6 @@ mmap(td, uap) handle_type = OBJT_VNODE; } map: - - /* - * Do not allow more then a certain number of vm_map_entry structures - * per process. Scale with the number of rforks sharing the map - * to make the limit reasonable for threads. - */ - if (max_proc_mmap && - vms->vm_map.nentries >= max_proc_mmap * vms->vm_refcnt) { - error = ENOMEM; - goto done; - } - td->td_fpop = fp; error = vm_mmap(&vms->vm_map, &addr, size, prot, maxprot, flags, handle_type, handle, pos);