Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151250168
D50073.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D50073.diff
View Options
diff --git a/sys/kern/kern_idle.c b/sys/kern/kern_idle.c
--- a/sys/kern/kern_idle.c
+++ b/sys/kern/kern_idle.c
@@ -82,4 +82,7 @@
#ifdef SMP
}
#endif
+ PROC_LOCK(p);
+ p->p_flag |= P_IDLEPROC;
+ PROC_UNLOCK(p);
}
diff --git a/sys/kern/kern_racct.c b/sys/kern/kern_racct.c
--- a/sys/kern/kern_racct.c
+++ b/sys/kern/kern_racct.c
@@ -322,15 +322,13 @@
u_int swtime;
#ifdef SCHED_4BSD
fixpt_t pctcpu, pctcpu_next;
-#endif
-#ifdef SMP
- struct pcpu *pc;
- int found;
#endif
fixpt_t p_pctcpu;
struct thread *td;
ASSERT_RACCT_ENABLED();
+ KASSERT((p->p_flag & P_IDLEPROC) == 0,
+ ("racct_getpcpu: idle process %p", p));
swtime = (ticks - p->p_swtick) / hz;
@@ -344,19 +342,6 @@
p_pctcpu = 0;
FOREACH_THREAD_IN_PROC(p, td) {
- if (td == PCPU_GET(idlethread))
- continue;
-#ifdef SMP
- found = 0;
- STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
- if (td == pc->pc_idlethread) {
- found = 1;
- break;
- }
- }
- if (found)
- continue;
-#endif
thread_lock(td);
#ifdef SCHED_4BSD
pctcpu = sched_pctcpu(td);
@@ -1252,7 +1237,8 @@
FOREACH_PROC_IN_SYSTEM(p) {
PROC_LOCK(p);
- if (p->p_state != PRS_NORMAL) {
+ if (p->p_state != PRS_NORMAL ||
+ (p->p_flag & P_IDLEPROC) != 0) {
if (p->p_state == PRS_ZOMBIE)
racct_set(p, RACCT_PCTCPU, 0);
PROC_UNLOCK(p);
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -803,7 +803,7 @@
lock. */
#define P_CONTROLT 0x00000002 /* Has a controlling terminal. */
#define P_KPROC 0x00000004 /* Kernel process. */
-#define P_UNUSED3 0x00000008 /* --available-- */
+#define P_IDLEPROC 0x00000008 /* Container for system idle threads. */
#define P_PPWAIT 0x00000010 /* Parent is waiting for child to
exec/exit. */
#define P_PROFIL 0x00000020 /* Has started profiling. */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 8, 3:04 AM (9 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31013064
Default Alt Text
D50073.diff (1 KB)
Attached To
Mode
D50073: racct: Fix accounting of CPU time for the system idle process
Attached
Detach File
Event Timeline
Log In to Comment