diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-03 20:12:13 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-03 20:12:13 -0400 |
| commit | 7f0ef0267e20d62d45d527911a993b1e998f4968 (patch) | |
| tree | de51abc7da5903f59d83e23937f22420164c9477 /lib | |
| parent | 862f0012549110d6f2586bf54b52ed4540cbff3a (diff) | |
| parent | 9307c29524502c21f0e8a6d96d850b2f5bc0bd9a (diff) | |
Merge branch 'akpm' (updates from Andrew Morton)
Merge first patch-bomb from Andrew Morton:
- various misc bits
- I'm been patchmonkeying ocfs2 for a while, as Joel and Mark have been
distracted. There has been quite a bit of activity.
- About half the MM queue
- Some backlight bits
- Various lib/ updates
- checkpatch updates
- zillions more little rtc patches
- ptrace
- signals
- exec
- procfs
- rapidio
- nbd
- aoe
- pps
- memstick
- tools/testing/selftests updates
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (445 commits)
tools/testing/selftests: don't assume the x bit is set on scripts
selftests: add .gitignore for kcmp
selftests: fix clean target in kcmp Makefile
selftests: add .gitignore for vm
selftests: add hugetlbfstest
self-test: fix make clean
selftests: exit 1 on failure
kernel/resource.c: remove the unneeded assignment in function __find_resource
aio: fix wrong comment in aio_complete()
drivers/w1/slaves/w1_ds2408.c: add magic sequence to disable P0 test mode
drivers/memstick/host/r592.c: convert to module_pci_driver
drivers/memstick/host/jmb38x_ms: convert to module_pci_driver
pps-gpio: add device-tree binding and support
drivers/pps/clients/pps-gpio.c: convert to module_platform_driver
drivers/pps/clients/pps-gpio.c: convert to devm_* helpers
drivers/parport/share.c: use kzalloc
Documentation/accounting/getdelays.c: avoid strncpy in accounting tool
aoe: update internal version number to v83
aoe: update copyright date
aoe: perform I/O completions in parallel
...
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dump_stack.c | 47 | ||||
| -rw-r--r-- | lib/idr.c | 7 | ||||
| -rw-r--r-- | lib/percpu_counter.c | 2 |
3 files changed, 48 insertions, 8 deletions
diff --git a/lib/dump_stack.c b/lib/dump_stack.c index 53bad099ebd6..c03154173cc7 100644 --- a/lib/dump_stack.c +++ b/lib/dump_stack.c | |||
| @@ -6,15 +6,58 @@ | |||
| 6 | #include <linux/kernel.h> | 6 | #include <linux/kernel.h> |
| 7 | #include <linux/export.h> | 7 | #include <linux/export.h> |
| 8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
| 9 | #include <linux/smp.h> | ||
| 10 | #include <linux/atomic.h> | ||
| 11 | |||
| 12 | static void __dump_stack(void) | ||
| 13 | { | ||
| 14 | dump_stack_print_info(KERN_DEFAULT); | ||
| 15 | show_stack(NULL, NULL); | ||
| 16 | } | ||
| 9 | 17 | ||
| 10 | /** | 18 | /** |
| 11 | * dump_stack - dump the current task information and its stack trace | 19 | * dump_stack - dump the current task information and its stack trace |
| 12 | * | 20 | * |
| 13 | * Architectures can override this implementation by implementing its own. | 21 | * Architectures can override this implementation by implementing its own. |
| 14 | */ | 22 | */ |
| 23 | #ifdef CONFIG_SMP | ||
| 24 | static atomic_t dump_lock = ATOMIC_INIT(-1); | ||
| 25 | |||
| 15 | void dump_stack(void) | 26 | void dump_stack(void) |
| 16 | { | 27 | { |
| 17 | dump_stack_print_info(KERN_DEFAULT); | 28 | int was_locked; |
| 18 | show_stack(NULL, NULL); | 29 | int old; |
| 30 | int cpu; | ||
| 31 | |||
| 32 | /* | ||
| 33 | * Permit this cpu to perform nested stack dumps while serialising | ||
| 34 | * against other CPUs | ||
| 35 | */ | ||
| 36 | preempt_disable(); | ||
| 37 | |||
| 38 | retry: | ||
| 39 | cpu = smp_processor_id(); | ||
| 40 | old = atomic_cmpxchg(&dump_lock, -1, cpu); | ||
| 41 | if (old == -1) { | ||
| 42 | was_locked = 0; | ||
| 43 | } else if (old == cpu) { | ||
| 44 | was_locked = 1; | ||
| 45 | } else { | ||
| 46 | cpu_relax(); | ||
| 47 | goto retry; | ||
| 48 | } | ||
| 49 | |||
| 50 | __dump_stack(); | ||
| 51 | |||
| 52 | if (!was_locked) | ||
| 53 | atomic_set(&dump_lock, -1); | ||
| 54 | |||
| 55 | preempt_enable(); | ||
| 56 | } | ||
| 57 | #else | ||
| 58 | void dump_stack(void) | ||
| 59 | { | ||
| 60 | __dump_stack(); | ||
| 19 | } | 61 | } |
| 62 | #endif | ||
| 20 | EXPORT_SYMBOL(dump_stack); | 63 | EXPORT_SYMBOL(dump_stack); |
| @@ -524,9 +524,7 @@ EXPORT_SYMBOL(idr_alloc_cyclic); | |||
| 524 | 524 | ||
| 525 | static void idr_remove_warning(int id) | 525 | static void idr_remove_warning(int id) |
| 526 | { | 526 | { |
| 527 | printk(KERN_WARNING | 527 | WARN(1, "idr_remove called for id=%d which is not allocated.\n", id); |
| 528 | "idr_remove called for id=%d which is not allocated.\n", id); | ||
| 529 | dump_stack(); | ||
| 530 | } | 528 | } |
| 531 | 529 | ||
| 532 | static void sub_remove(struct idr *idp, int shift, int id) | 530 | static void sub_remove(struct idr *idp, int shift, int id) |
| @@ -1064,8 +1062,7 @@ void ida_remove(struct ida *ida, int id) | |||
| 1064 | return; | 1062 | return; |
| 1065 | 1063 | ||
| 1066 | err: | 1064 | err: |
| 1067 | printk(KERN_WARNING | 1065 | WARN(1, "ida_remove called for id=%d which is not allocated.\n", id); |
| 1068 | "ida_remove called for id=%d which is not allocated.\n", id); | ||
| 1069 | } | 1066 | } |
| 1070 | EXPORT_SYMBOL(ida_remove); | 1067 | EXPORT_SYMBOL(ida_remove); |
| 1071 | 1068 | ||
diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c index ba6085d9c741..1fc23a3277e1 100644 --- a/lib/percpu_counter.c +++ b/lib/percpu_counter.c | |||
| @@ -80,8 +80,8 @@ void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch) | |||
| 80 | if (count >= batch || count <= -batch) { | 80 | if (count >= batch || count <= -batch) { |
| 81 | raw_spin_lock(&fbc->lock); | 81 | raw_spin_lock(&fbc->lock); |
| 82 | fbc->count += count; | 82 | fbc->count += count; |
| 83 | __this_cpu_write(*fbc->counters, 0); | ||
| 84 | raw_spin_unlock(&fbc->lock); | 83 | raw_spin_unlock(&fbc->lock); |
| 84 | __this_cpu_write(*fbc->counters, 0); | ||
| 85 | } else { | 85 | } else { |
| 86 | __this_cpu_write(*fbc->counters, count); | 86 | __this_cpu_write(*fbc->counters, count); |
| 87 | } | 87 | } |
