svn commit: r297492 - head/sys/kern

Edward Tomasz Napierala trasz at FreeBSD.org
Fri Apr 1 17:28:57 UTC 2016


Author: trasz
Date: Fri Apr  1 17:28:55 2016
New Revision: 297492
URL: https://svnweb.freebsd.org/changeset/base/297492

Log:
  Call rctl_enforce() in all cases the resource usage goes up, even when called
  from racct_*_force() functions.  It makes the "log" and "devctl" actions work
  in those cases.
  
  MFC after:	1 month
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/kern/kern_racct.c

Modified: head/sys/kern/kern_racct.c
==============================================================================
--- head/sys/kern/kern_racct.c	Fri Apr  1 17:21:55 2016	(r297491)
+++ head/sys/kern/kern_racct.c	Fri Apr  1 17:28:55 2016	(r297492)
@@ -548,12 +548,10 @@ racct_add_locked(struct proc *p, int res
 	PROC_LOCK_ASSERT(p, MA_OWNED);
 
 #ifdef RCTL
-	if (!force) {
-		error = rctl_enforce(p, resource, amount);
-		if (error && RACCT_IS_DENIABLE(resource)) {
-			SDT_PROBE3(racct, , rusage, add__failure, p, resource, amount);
-			return (error);
-		}
+	error = rctl_enforce(p, resource, amount);
+	if (error && !force && RACCT_IS_DENIABLE(resource)) {
+		SDT_PROBE3(racct, , rusage, add__failure, p, resource, amount);
+		return (error);
 	}
 #endif
 	racct_adjust_resource(p->p_racct, resource, amount);
@@ -670,9 +668,9 @@ racct_set_locked(struct proc *p, int res
 	     resource));
 #endif
 #ifdef RCTL
-	if (!force && diff_proc > 0) {
+	if (diff_proc > 0) {
 		error = rctl_enforce(p, resource, diff_proc);
-		if (error && RACCT_IS_DENIABLE(resource)) {
+		if (error && !force && RACCT_IS_DENIABLE(resource)) {
 			SDT_PROBE3(racct, , rusage, set__failure, p, resource,
 			    amount);
 			return (error);


More information about the svn-src-all mailing list