aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/bust_spinlocks.c2
-rw-r--r--lib/fault-inject.c1
-rw-r--r--lib/percpu_counter.c18
-rw-r--r--lib/prio_heap.c2
-rw-r--r--lib/proportions.c2
-rw-r--r--lib/radix-tree.c2
-rw-r--r--lib/vsprintf.c4
7 files changed, 24 insertions, 7 deletions
diff --git a/lib/bust_spinlocks.c b/lib/bust_spinlocks.c
index 486da62b2b07..9681d54b95d1 100644
--- a/lib/bust_spinlocks.c
+++ b/lib/bust_spinlocks.c
@@ -12,6 +12,7 @@
12#include <linux/tty.h> 12#include <linux/tty.h>
13#include <linux/wait.h> 13#include <linux/wait.h>
14#include <linux/vt_kern.h> 14#include <linux/vt_kern.h>
15#include <linux/console.h>
15 16
16 17
17void __attribute__((weak)) bust_spinlocks(int yes) 18void __attribute__((weak)) bust_spinlocks(int yes)
@@ -22,6 +23,7 @@ void __attribute__((weak)) bust_spinlocks(int yes)
22#ifdef CONFIG_VT 23#ifdef CONFIG_VT
23 unblank_screen(); 24 unblank_screen();
24#endif 25#endif
26 console_unblank();
25 if (--oops_in_progress == 0) 27 if (--oops_in_progress == 0)
26 wake_up_klogd(); 28 wake_up_klogd();
27 } 29 }
diff --git a/lib/fault-inject.c b/lib/fault-inject.c
index a50a311554cc..f97af55bdd96 100644
--- a/lib/fault-inject.c
+++ b/lib/fault-inject.c
@@ -6,7 +6,6 @@
6#include <linux/fs.h> 6#include <linux/fs.h>
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/interrupt.h> 8#include <linux/interrupt.h>
9#include <linux/unwind.h>
10#include <linux/stacktrace.h> 9#include <linux/stacktrace.h>
11#include <linux/kallsyms.h> 10#include <linux/kallsyms.h>
12#include <linux/fault-inject.h> 11#include <linux/fault-inject.h>
diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c
index b255b939bc1b..a60bd8046095 100644
--- a/lib/percpu_counter.c
+++ b/lib/percpu_counter.c
@@ -9,10 +9,8 @@
9#include <linux/cpu.h> 9#include <linux/cpu.h>
10#include <linux/module.h> 10#include <linux/module.h>
11 11
12#ifdef CONFIG_HOTPLUG_CPU
13static LIST_HEAD(percpu_counters); 12static LIST_HEAD(percpu_counters);
14static DEFINE_MUTEX(percpu_counters_lock); 13static DEFINE_MUTEX(percpu_counters_lock);
15#endif
16 14
17void percpu_counter_set(struct percpu_counter *fbc, s64 amount) 15void percpu_counter_set(struct percpu_counter *fbc, s64 amount)
18{ 16{
@@ -111,13 +109,24 @@ void percpu_counter_destroy(struct percpu_counter *fbc)
111} 109}
112EXPORT_SYMBOL(percpu_counter_destroy); 110EXPORT_SYMBOL(percpu_counter_destroy);
113 111
114#ifdef CONFIG_HOTPLUG_CPU 112int percpu_counter_batch __read_mostly = 32;
113EXPORT_SYMBOL(percpu_counter_batch);
114
115static void compute_batch_value(void)
116{
117 int nr = num_online_cpus();
118
119 percpu_counter_batch = max(32, nr*2);
120}
121
115static int __cpuinit percpu_counter_hotcpu_callback(struct notifier_block *nb, 122static int __cpuinit percpu_counter_hotcpu_callback(struct notifier_block *nb,
116 unsigned long action, void *hcpu) 123 unsigned long action, void *hcpu)
117{ 124{
125#ifdef CONFIG_HOTPLUG_CPU
118 unsigned int cpu; 126 unsigned int cpu;
119 struct percpu_counter *fbc; 127 struct percpu_counter *fbc;
120 128
129 compute_batch_value();
121 if (action != CPU_DEAD) 130 if (action != CPU_DEAD)
122 return NOTIFY_OK; 131 return NOTIFY_OK;
123 132
@@ -134,13 +143,14 @@ static int __cpuinit percpu_counter_hotcpu_callback(struct notifier_block *nb,
134 spin_unlock_irqrestore(&fbc->lock, flags); 143 spin_unlock_irqrestore(&fbc->lock, flags);
135 } 144 }
136 mutex_unlock(&percpu_counters_lock); 145 mutex_unlock(&percpu_counters_lock);
146#endif
137 return NOTIFY_OK; 147 return NOTIFY_OK;
138} 148}
139 149
140static int __init percpu_counter_startup(void) 150static int __init percpu_counter_startup(void)
141{ 151{
152 compute_batch_value();
142 hotcpu_notifier(percpu_counter_hotcpu_callback, 0); 153 hotcpu_notifier(percpu_counter_hotcpu_callback, 0);
143 return 0; 154 return 0;
144} 155}
145module_init(percpu_counter_startup); 156module_init(percpu_counter_startup);
146#endif
diff --git a/lib/prio_heap.c b/lib/prio_heap.c
index 471944a54e23..a7af6f85eca8 100644
--- a/lib/prio_heap.c
+++ b/lib/prio_heap.c
@@ -31,7 +31,7 @@ void *heap_insert(struct ptr_heap *heap, void *p)
31 31
32 if (heap->size < heap->max) { 32 if (heap->size < heap->max) {
33 /* Heap insertion */ 33 /* Heap insertion */
34 int pos = heap->size++; 34 pos = heap->size++;
35 while (pos > 0 && heap->gt(p, ptrs[(pos-1)/2])) { 35 while (pos > 0 && heap->gt(p, ptrs[(pos-1)/2])) {
36 ptrs[pos] = ptrs[(pos-1)/2]; 36 ptrs[pos] = ptrs[(pos-1)/2];
37 pos = (pos-1)/2; 37 pos = (pos-1)/2;
diff --git a/lib/proportions.c b/lib/proportions.c
index 4f387a643d72..3fda810faf0d 100644
--- a/lib/proportions.c
+++ b/lib/proportions.c
@@ -147,6 +147,7 @@ out:
147 * this is used to track the active references. 147 * this is used to track the active references.
148 */ 148 */
149static struct prop_global *prop_get_global(struct prop_descriptor *pd) 149static struct prop_global *prop_get_global(struct prop_descriptor *pd)
150__acquires(RCU)
150{ 151{
151 int index; 152 int index;
152 153
@@ -160,6 +161,7 @@ static struct prop_global *prop_get_global(struct prop_descriptor *pd)
160} 161}
161 162
162static void prop_put_global(struct prop_descriptor *pd, struct prop_global *pg) 163static void prop_put_global(struct prop_descriptor *pd, struct prop_global *pg)
164__releases(RCU)
163{ 165{
164 rcu_read_unlock(); 166 rcu_read_unlock();
165} 167}
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index be86b32bc874..8d3fb0bd1288 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -81,7 +81,7 @@ struct radix_tree_preload {
81 int nr; 81 int nr;
82 struct radix_tree_node *nodes[RADIX_TREE_MAX_PATH]; 82 struct radix_tree_node *nodes[RADIX_TREE_MAX_PATH];
83}; 83};
84DEFINE_PER_CPU(struct radix_tree_preload, radix_tree_preloads) = { 0, }; 84static DEFINE_PER_CPU(struct radix_tree_preload, radix_tree_preloads) = { 0, };
85 85
86static inline gfp_t root_gfp_mask(struct radix_tree_root *root) 86static inline gfp_t root_gfp_mask(struct radix_tree_root *root)
87{ 87{
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 98d632277ca8..0fbd0121d91d 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -170,6 +170,8 @@ int strict_strtoul(const char *cp, unsigned int base, unsigned long *res)
170 return -EINVAL; 170 return -EINVAL;
171 171
172 val = simple_strtoul(cp, &tail, base); 172 val = simple_strtoul(cp, &tail, base);
173 if (tail == cp)
174 return -EINVAL;
173 if ((*tail == '\0') || 175 if ((*tail == '\0') ||
174 ((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) { 176 ((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {
175 *res = val; 177 *res = val;
@@ -241,6 +243,8 @@ int strict_strtoull(const char *cp, unsigned int base, unsigned long long *res)
241 return -EINVAL; 243 return -EINVAL;
242 244
243 val = simple_strtoull(cp, &tail, base); 245 val = simple_strtoull(cp, &tail, base);
246 if (tail == cp)
247 return -EINVAL;
244 if ((*tail == '\0') || 248 if ((*tail == '\0') ||
245 ((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) { 249 ((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {
246 *res = val; 250 *res = val;