svn commit: r198330 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci vm

Konstantin Belousov kib at FreeBSD.org
Wed Oct 21 15:07:34 UTC 2009


Author: kib
Date: Wed Oct 21 15:07:34 2009
New Revision: 198330
URL: http://svn.freebsd.org/changeset/base/198330

Log:
  MFC r198201:
  Remove spurious call to priv_check(PRIV_VM_SWAP_NOQUOTA).
  Call priv_check(PRIV_VM_SWAP_NORLIMIT) only when per-uid limit is
  actually exceed.
  
  Approved by:	re (kensmith)

Modified:
  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)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/vm/swap_pager.c

Modified: stable/8/sys/vm/swap_pager.c
==============================================================================
--- stable/8/sys/vm/swap_pager.c	Wed Oct 21 15:04:50 2009	(r198329)
+++ stable/8/sys/vm/swap_pager.c	Wed Oct 21 15:07:34 2009	(r198330)
@@ -176,7 +176,7 @@ swap_reserve(vm_ooffset_t incr)
 int
 swap_reserve_by_uid(vm_ooffset_t incr, struct uidinfo *uip)
 {
-	vm_ooffset_t r, s, max;
+	vm_ooffset_t r, s;
 	int res, error;
 	static int curfail;
 	static struct timeval lastfail;
@@ -185,7 +185,6 @@ swap_reserve_by_uid(vm_ooffset_t incr, s
 		panic("swap_reserve: & PAGE_MASK");
 
 	res = 0;
-	error = priv_check(curthread, PRIV_VM_SWAP_NOQUOTA);
 	mtx_lock(&sw_dev_mtx);
 	r = swap_reserved + incr;
 	if (overcommit & SWAP_RESERVE_ALLOW_NONWIRED) {
@@ -204,10 +203,9 @@ swap_reserve_by_uid(vm_ooffset_t incr, s
 	if (res) {
 		PROC_LOCK(curproc);
 		UIDINFO_VMSIZE_LOCK(uip);
-		error = priv_check(curthread, PRIV_VM_SWAP_NORLIMIT);
-		max = (error != 0) ? lim_cur(curproc, RLIMIT_SWAP) : 0;
-		if (max != 0 && uip->ui_vmsize + incr > max &&
-		    (overcommit & SWAP_RESERVE_RLIMIT_ON) != 0)
+		if ((overcommit & SWAP_RESERVE_RLIMIT_ON) != 0 &&
+		    uip->ui_vmsize + incr > lim_cur(curproc, RLIMIT_SWAP) &&
+		    priv_check(curthread, PRIV_VM_SWAP_NORLIMIT))
 			res = 0;
 		else
 			uip->ui_vmsize += incr;


More information about the svn-src-stable-8 mailing list