svn commit: r247800 - head/sys/kern

Davide Italiano davide at FreeBSD.org
Mon Mar 4 16:25:13 UTC 2013


Author: davide
Date: Mon Mar  4 16:25:12 2013
New Revision: 247800
URL: http://svnweb.freebsd.org/changeset/base/247800

Log:
  MFcalloutng (r244251 with minor changes):
  Specify that precision of 0.5s is enough for resource limitation.
  
  Sponsored by:	Google Summer of Code 2012, iXsystems inc.
  Tested by:	flo, marius, ian, markj, Fabian Keil

Modified:
  head/sys/kern/kern_resource.c

Modified: head/sys/kern/kern_resource.c
==============================================================================
--- head/sys/kern/kern_resource.c	Mon Mar  4 16:16:23 2013	(r247799)
+++ head/sys/kern/kern_resource.c	Mon Mar  4 16:25:12 2013	(r247800)
@@ -645,7 +645,8 @@ lim_cb(void *arg)
 		}
 	}
 	if ((p->p_flag & P_WEXIT) == 0)
-		callout_reset(&p->p_limco, hz, lim_cb, p);
+		callout_reset_sbt(&p->p_limco, SBT_1S, 0,
+		    lim_cb, p, C_PREL(1));
 }
 
 int
@@ -697,7 +698,8 @@ kern_proc_setrlimit(struct thread *td, s
 	case RLIMIT_CPU:
 		if (limp->rlim_cur != RLIM_INFINITY &&
 		    p->p_cpulimit == RLIM_INFINITY)
-			callout_reset(&p->p_limco, hz, lim_cb, p);
+			callout_reset_sbt(&p->p_limco, SBT_1S, 0,
+			    lim_cb, p, C_PREL(1));
 		p->p_cpulimit = limp->rlim_cur;
 		break;
 	case RLIMIT_DATA:
@@ -1137,7 +1139,8 @@ lim_fork(struct proc *p1, struct proc *p
 	p2->p_limit = lim_hold(p1->p_limit);
 	callout_init_mtx(&p2->p_limco, &p2->p_mtx, 0);
 	if (p1->p_cpulimit != RLIM_INFINITY)
-		callout_reset(&p2->p_limco, hz, lim_cb, p2);
+		callout_reset_sbt(&p2->p_limco, SBT_1S, 0,
+		    lim_cb, p2, C_PREL(1));
 }
 
 void


More information about the svn-src-all mailing list