Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Jul 2012 22:29:50 +0000
From:      rudot@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r239878 - soc2012/rudot/sys/kern
Message-ID:  <20120728222950.A3E84106564A@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rudot
Date: Sat Jul 28 22:29:49 2012
New Revision: 239878
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=239878

Log:
  do not count cpu idlethread in the %cpu of the root user

Modified:
  soc2012/rudot/sys/kern/kern_racct.c

Modified: soc2012/rudot/sys/kern/kern_racct.c
==============================================================================
--- soc2012/rudot/sys/kern/kern_racct.c	Sat Jul 28 21:59:12 2012	(r239877)
+++ soc2012/rudot/sys/kern/kern_racct.c	Sat Jul 28 22:29:49 2012	(r239878)
@@ -288,6 +288,10 @@
 #ifdef SCHED_4BSD
 	fixpt_t pctcpu, pctcpu_next;
 #endif
+#ifdef SMP
+	struct pcpu *pc;
+	u_int cpuid;	
+#endif
 	fixpt_t p_pctcpu;
 	struct thread *td;
 
@@ -297,6 +301,16 @@
 
 	p_pctcpu = 0;
 	FOREACH_THREAD_IN_PROC(p, td) {
+		if (td == PCPU_GET(idlethread))
+			continue;
+#ifdef SMP
+		cpuid = td->td_oncpu;
+		if (cpuid != NOCPU) {
+			pc = pcpu_find(cpuid);
+			if (td == pc->pc_idlethread)
+				continue;
+		}
+#endif
 		thread_lock(td);
 #ifdef SCHED_4BSD
 		pctcpu = sched_pctcpu(td);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120728222950.A3E84106564A>