From owner-cvs-src-old@FreeBSD.ORG Tue Jun 23 20:50:28 2009 Return-Path: Delivered-To: cvs-src-old@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69A5B1065679 for ; Tue, 23 Jun 2009 20:50:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 532BF8FC20 for ; Tue, 23 Jun 2009 20:50:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NKoSRZ069002 for ; Tue, 23 Jun 2009 20:50:28 GMT (envelope-from kib@repoman.freebsd.org) Received: (from svn2cvs@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n5NKoS6V069001 for cvs-src-old@freebsd.org; Tue, 23 Jun 2009 20:50:28 GMT (envelope-from kib@repoman.freebsd.org) Message-Id: <200906232050.n5NKoS6V069001@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to kib@repoman.freebsd.org using -f From: Konstantin Belousov Date: Tue, 23 Jun 2009 20:45:22 +0000 (UTC) To: cvs-src-old@freebsd.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/dev/md md.c src/sys/fs/procfs procfs_map.c src/sys/fs/tmpfs tmpfs_subr.c src/sys/kern kern_fork.c kern_resource.c sys_process.c sysv_shm.c uipc_shm.c src/sys/security/mac_biba mac_biba.c src/sys/security/mac_lomac ... X-BeenThere: cvs-src-old@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 20:50:28 -0000 kib 2009-06-23 20:45:22 UTC FreeBSD src repository Modified files: sys/dev/md md.c sys/fs/procfs procfs_map.c sys/fs/tmpfs tmpfs_subr.c sys/kern kern_fork.c kern_resource.c sys_process.c sysv_shm.c uipc_shm.c sys/security/mac_biba mac_biba.c sys/security/mac_lomac mac_lomac.c sys/sys priv.h resource.h resourcevar.h sys/vm default_pager.c device_pager.c phys_pager.c swap_pager.c vm.h Log: SVN rev 194766 on 2009-06-23 20:45:22Z by kib Implement global and per-uid accounting of the anonymous memory. Add rlimit RLIMIT_SWAP that limits the amount of swap that may be reserved for the uid. The accounting information (charge) is associated with either map entry, or vm object backing the entry, assuming the object is the first one in the shadow chain and entry does not require COW. Charge is moved from entry to object on allocation of the object, e.g. during the mmap, assuming the object is allocated, or on the first page fault on the entry. It moves back to the entry on forks due to COW setup. The per-entry granularity of accounting makes the charge process fair for processes that change uid during lifetime, and decrements charge for proper uid when region is unmapped. The interface of vm_pager_allocate(9) is extended by adding struct ucred *, that is used to charge appropriate uid when allocation if performed by kernel, e.g. md(4). Several syscalls, among them is fork(2), may now return ENOMEM when global or per-uid limits are enforced. In collaboration with: pho Reviewed by: alc Approved by: re (kensmith) Revision Changes Path 1.182 +4 -4 src/sys/dev/md/md.c 1.50 +8 -3 src/sys/fs/procfs/procfs_map.c 1.23 +2 -1 src/sys/fs/tmpfs/tmpfs_subr.c 1.304 +16 -2 src/sys/kern/kern_fork.c 1.194 +6 -0 src/sys/kern/kern_resource.c 1.153 +5 -1 src/sys/kern/sys_process.c 1.119 +4 -7 src/sys/kern/sysv_shm.c 1.10 +23 -8 src/sys/kern/uipc_shm.c 1.134 +2 -0 src/sys/security/mac_biba/mac_biba.c 1.78 +2 -0 src/sys/security/mac_lomac/mac_lomac.c 1.35 +8 -0 src/sys/sys/priv.h 1.35 +3 -1 src/sys/sys/resource.h 1.55 +6 -0 src/sys/sys/resourcevar.h 1.36 +21 -4 src/sys/vm/default_pager.c 1.89 +3 -2 src/sys/vm/device_pager.c 1.31 +1 -1 src/sys/vm/phys_pager.c 1.311 +152 -7 src/sys/vm/swap_pager.c 1.29 +7 -0 src/sys/vm/vm.h