diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-12-12 13:48:57 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-12-12 13:48:57 +0100 |
commit | 45ab6b0c76d0e4cce5bd608ccf97b0f6b20f18df (patch) | |
tree | 4d51c73533c386aee16fde1e74b5e3bc22eedc53 /lib | |
parent | Merge branch 'tracing/fastboot' into cpus4096 (diff) | |
parent | sched: add missing arch_update_cpu_topology() call (diff) | |
download | linux-45ab6b0c76d0e4cce5bd608ccf97b0f6b20f18df.tar.xz linux-45ab6b0c76d0e4cce5bd608ccf97b0f6b20f18df.zip |
Merge branch 'sched/core' into cpus4096
Conflicts:
include/linux/ftrace.h
kernel/sched.c
Diffstat (limited to 'lib')
-rw-r--r-- | lib/idr.c | 8 | ||||
-rw-r--r-- | lib/percpu_counter.c | 7 |
2 files changed, 9 insertions, 6 deletions
diff --git a/lib/idr.c b/lib/idr.c index 7a785a0c2ea0..1c4f9281f412 100644 --- a/lib/idr.c +++ b/lib/idr.c @@ -220,8 +220,14 @@ build_up: */ while ((layers < (MAX_LEVEL - 1)) && (id >= (1 << (layers*IDR_BITS)))) { layers++; - if (!p->count) + if (!p->count) { + /* special case: if the tree is currently empty, + * then we grow the tree by moving the top node + * upwards. + */ + p->layer++; continue; + } if (!(new = get_from_free_list(idp))) { /* * The allocation failed. If we built part of diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c index a8663890a88c..b255b939bc1b 100644 --- a/lib/percpu_counter.c +++ b/lib/percpu_counter.c @@ -62,10 +62,7 @@ s64 __percpu_counter_sum(struct percpu_counter *fbc) for_each_online_cpu(cpu) { s32 *pcount = per_cpu_ptr(fbc->counters, cpu); ret += *pcount; - *pcount = 0; } - fbc->count = ret; - spin_unlock(&fbc->lock); return ret; } @@ -104,13 +101,13 @@ void percpu_counter_destroy(struct percpu_counter *fbc) if (!fbc->counters) return; - free_percpu(fbc->counters); - fbc->counters = NULL; #ifdef CONFIG_HOTPLUG_CPU mutex_lock(&percpu_counters_lock); list_del(&fbc->list); mutex_unlock(&percpu_counters_lock); #endif + free_percpu(fbc->counters); + fbc->counters = NULL; } EXPORT_SYMBOL(percpu_counter_destroy); |