aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2009-10-21 15:07:34 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2009-10-21 15:07:34 +0000
commit46aaa1ed67f492f792292d2cef553323803fa756 (patch)
tree9152be1cf4114f14c2d9e024da55fdc7b0a0db92
parentcbdd92bda4d6f630c198c9df4fab61aed260a36a (diff)
downloadsrc-46aaa1ed67f492f792292d2cef553323803fa756.tar.gz
src-46aaa1ed67f492f792292d2cef553323803fa756.zip
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)
Notes
Notes: svn path=/stable/8/; revision=198330
-rw-r--r--sys/vm/swap_pager.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index de33ebaadda1..229dac8585b9 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -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, struct uidinfo *uip)
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, struct uidinfo *uip)
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;