diff options
author | trasz <trasz@FreeBSD.org> | 2012-04-17 14:31:02 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2012-04-17 14:31:02 +0000 |
commit | 29ba0a35f6797ce4bf491112e3cf87135d7699fa (patch) | |
tree | 4f48cd880982ffd18aedf55994073cafdde2ea5c /sys/kern/kern_racct.c | |
parent | a41bb18a2972ad4367c7880992b63b7e4b3df8ee (diff) | |
download | FreeBSD-src-29ba0a35f6797ce4bf491112e3cf87135d7699fa.zip FreeBSD-src-29ba0a35f6797ce4bf491112e3cf87135d7699fa.tar.gz |
Stop treating system processes as special. This fixes panics
like the one triggered by this:
# kldload geom_vinum
# pwait `pgrep -S gv_worker` &
# kldunload geom_vinum
or this:
GEOM_JOURNAL: Shutting down geom gjournal 3464572051.
panic: destroying non-empty racct: 1 allocated for resource 6
which were tracked by jh@ to be caused by checking p->p_flag,
while it wasn't initialised yet. Basically, during fork, the code
checked p_flag, concluded the process isn't marked as P_SYSTEM,
incremented the counter, and later on, when exiting, checked that
the process was marked as P_SYSTEM, and thus didn't decrement it.
Also, I believe there wasn't any good reason for checking P_SYSTEM
in the first place.
Tested by: jh
Diffstat (limited to 'sys/kern/kern_racct.c')
-rw-r--r-- | sys/kern/kern_racct.c | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/sys/kern/kern_racct.c b/sys/kern/kern_racct.c index 5ba6773..081b312 100644 --- a/sys/kern/kern_racct.c +++ b/sys/kern/kern_racct.c @@ -267,9 +267,6 @@ racct_add_locked(struct proc *p, int resource, uint64_t amount) int error; #endif - if (p->p_flag & P_SYSTEM) - return (0); - SDT_PROBE(racct, kernel, rusage, add, p, resource, amount, 0, 0); /* @@ -344,9 +341,6 @@ void racct_add_force(struct proc *p, int resource, uint64_t amount) { - if (p->p_flag & P_SYSTEM) - return; - SDT_PROBE(racct, kernel, rusage, add_force, p, resource, amount, 0, 0); /* @@ -368,9 +362,6 @@ racct_set_locked(struct proc *p, int resource, uint64_t amount) int error; #endif - if (p->p_flag & P_SYSTEM) - return (0); - SDT_PROBE(racct, kernel, rusage, set, p, resource, amount, 0, 0); /* @@ -426,9 +417,6 @@ racct_set_force(struct proc *p, int resource, uint64_t amount) { int64_t diff; - if (p->p_flag & P_SYSTEM) - return; - SDT_PROBE(racct, kernel, rusage, set, p, resource, amount, 0, 0); /* @@ -487,9 +475,6 @@ void racct_sub(struct proc *p, int resource, uint64_t amount) { - if (p->p_flag & P_SYSTEM) - return; - SDT_PROBE(racct, kernel, rusage, sub, p, resource, amount, 0, 0); /* @@ -556,12 +541,6 @@ racct_proc_fork(struct proc *parent, struct proc *child) */ racct_create(&child->p_racct); - /* - * No resource accounting for kernel processes. - */ - if (child->p_flag & P_SYSTEM) - return (0); - PROC_LOCK(parent); PROC_LOCK(child); mtx_lock(&racct_lock); @@ -723,8 +702,6 @@ racctd(void) FOREACH_PROC_IN_SYSTEM(p) { if (p->p_state != PRS_NORMAL) continue; - if (p->p_flag & P_SYSTEM) - continue; microuptime(&wallclock); timevalsub(&wallclock, &p->p_stats->p_start); |