svn commit: r365710 - head/sys/kern

Edward Tomasz Napierala trasz at FreeBSD.org
Mon Sep 14 09:44:25 UTC 2020


Author: trasz
Date: Mon Sep 14 09:44:24 2020
New Revision: 365710
URL: https://svnweb.freebsd.org/changeset/base/365710

Log:
  Move racct/rctl throttling from userret() to ast().  There's no reason
  for it to sit in the syscall fast path.
  
  Reviewed by:	kib
  MFC after:	2 weeks
  Sponsored by:	DARPA
  Differential Revision:	https://reviews.freebsd.org/D26368

Modified:
  head/sys/kern/kern_racct.c
  head/sys/kern/subr_trap.c

Modified: head/sys/kern/kern_racct.c
==============================================================================
--- head/sys/kern/kern_racct.c	Mon Sep 14 08:59:16 2020	(r365709)
+++ head/sys/kern/kern_racct.c	Mon Sep 14 09:44:24 2020	(r365710)
@@ -1146,6 +1146,8 @@ racct_proc_throttle(struct proc *p, int timeout)
 
 	FOREACH_THREAD_IN_PROC(p, td) {
 		thread_lock(td);
+		td->td_flags |= TDF_ASTPENDING;
+
 		switch (td->td_state) {
 		case TDS_RUNQ:
 			/*

Modified: head/sys/kern/subr_trap.c
==============================================================================
--- head/sys/kern/subr_trap.c	Mon Sep 14 08:59:16 2020	(r365709)
+++ head/sys/kern/subr_trap.c	Mon Sep 14 09:44:24 2020	(r365710)
@@ -206,10 +206,6 @@ userret(struct thread *td, struct trapframe *frame)
 	    __func__, td, p->p_pid, td->td_name, curvnet,
 	    (td->td_vnet_lpush != NULL) ? td->td_vnet_lpush : "N/A"));
 #endif
-#ifdef RACCT
-	if (__predict_false(racct_enable && p->p_throttled != 0))
-		racct_proc_throttled(p);
-#endif
 }
 
 /*
@@ -361,6 +357,11 @@ ast(struct trapframe *framep)
 		td->td_pflags &= ~TDP_OLDMASK;
 		kern_sigprocmask(td, SIG_SETMASK, &td->td_oldsigmask, NULL, 0);
 	}
+
+#ifdef RACCT
+	if (__predict_false(racct_enable && p->p_throttled != 0))
+		racct_proc_throttled(p);
+#endif
 
 	userret(td, framep);
 }


More information about the svn-src-head mailing list