diff options
author | Tejun Heo <tj@kernel.org> | 2014-09-20 01:27:24 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2014-09-20 01:27:24 -0400 |
commit | 4843c3320c3d23ab4ecf520f5eaf485aff8c7252 (patch) | |
tree | 959c13745e8f4372ec5d0558a27af53ef9104758 /lib | |
parent | 23cb8981ed929b4dd48141401cd0fd31e0fa4ed0 (diff) |
percpu-refcount: improve WARN messages
percpu_ref's WARN messages can be a lot more helpful by indicating
who's the culprit. Make them report the release function that the
offending percpu-refcount is associated with. This should make it a
lot easier to track down the reported invalid refcnting operations.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/percpu-refcount.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/percpu-refcount.c b/lib/percpu-refcount.c index ff9903264a91..70d28c91f35a 100644 --- a/lib/percpu-refcount.c +++ b/lib/percpu-refcount.c | |||
@@ -145,8 +145,9 @@ static void percpu_ref_kill_rcu(struct rcu_head *rcu) | |||
145 | 145 | ||
146 | atomic_add((int) count - PCPU_COUNT_BIAS, &ref->count); | 146 | atomic_add((int) count - PCPU_COUNT_BIAS, &ref->count); |
147 | 147 | ||
148 | WARN_ONCE(atomic_read(&ref->count) <= 0, "percpu ref <= 0 (%i)", | 148 | WARN_ONCE(atomic_read(&ref->count) <= 0, |
149 | atomic_read(&ref->count)); | 149 | "percpu ref (%pf) <= 0 (%i) after killed", |
150 | ref->release, atomic_read(&ref->count)); | ||
150 | 151 | ||
151 | /* @ref is viewed as dead on all CPUs, send out kill confirmation */ | 152 | /* @ref is viewed as dead on all CPUs, send out kill confirmation */ |
152 | if (ref->confirm_kill) | 153 | if (ref->confirm_kill) |
@@ -178,7 +179,8 @@ void percpu_ref_kill_and_confirm(struct percpu_ref *ref, | |||
178 | percpu_ref_func_t *confirm_kill) | 179 | percpu_ref_func_t *confirm_kill) |
179 | { | 180 | { |
180 | WARN_ONCE(ref->pcpu_count_ptr & PCPU_REF_DEAD, | 181 | WARN_ONCE(ref->pcpu_count_ptr & PCPU_REF_DEAD, |
181 | "percpu_ref_kill() called more than once!\n"); | 182 | "percpu_ref_kill() called more than once on %pf!", |
183 | ref->release); | ||
182 | 184 | ||
183 | ref->pcpu_count_ptr |= PCPU_REF_DEAD; | 185 | ref->pcpu_count_ptr |= PCPU_REF_DEAD; |
184 | ref->confirm_kill = confirm_kill; | 186 | ref->confirm_kill = confirm_kill; |