aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig3
-rw-r--r--lib/Kconfig.debug11
-rw-r--r--lib/assoc_array.c6
-rw-r--r--lib/hweight.c4
-rw-r--r--lib/percpu-refcount.c16
-rw-r--r--lib/rhashtable.c1
-rw-r--r--lib/string.c4
7 files changed, 37 insertions, 8 deletions
diff --git a/lib/Kconfig b/lib/Kconfig
index a5ce0c7f6c30..54cf309a92a5 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -51,6 +51,9 @@ config PERCPU_RWSEM
51config ARCH_USE_CMPXCHG_LOCKREF 51config ARCH_USE_CMPXCHG_LOCKREF
52 bool 52 bool
53 53
54config ARCH_HAS_FAST_MULTIPLIER
55 bool
56
54config CRC_CCITT 57config CRC_CCITT
55 tristate "CRC-CCITT functions" 58 tristate "CRC-CCITT functions"
56 help 59 help
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 07c28323f88f..a28590083622 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -892,6 +892,10 @@ config DEBUG_WW_MUTEX_SLOWPATH
892 the full mutex checks enabled with (CONFIG_PROVE_LOCKING) this 892 the full mutex checks enabled with (CONFIG_PROVE_LOCKING) this
893 will test all possible w/w mutex interface abuse with the 893 will test all possible w/w mutex interface abuse with the
894 exception of simply not acquiring all the required locks. 894 exception of simply not acquiring all the required locks.
895 Note that this feature can introduce significant overhead, so
896 it really should not be enabled in a production or distro kernel,
897 even a debug kernel. If you are a driver writer, enable it. If
898 you are a distro, do not.
895 899
896config DEBUG_LOCK_ALLOC 900config DEBUG_LOCK_ALLOC
897 bool "Lock debugging: detect incorrect freeing of live locks" 901 bool "Lock debugging: detect incorrect freeing of live locks"
@@ -1032,8 +1036,13 @@ config TRACE_IRQFLAGS
1032 either tracing or lock debugging. 1036 either tracing or lock debugging.
1033 1037
1034config STACKTRACE 1038config STACKTRACE
1035 bool 1039 bool "Stack backtrace support"
1036 depends on STACKTRACE_SUPPORT 1040 depends on STACKTRACE_SUPPORT
1041 help
1042 This option causes the kernel to create a /proc/pid/stack for
1043 every process, showing its current stack trace.
1044 It is also used by various kernel debugging features that require
1045 stack trace generation.
1037 1046
1038config DEBUG_KOBJECT 1047config DEBUG_KOBJECT
1039 bool "kobject debugging" 1048 bool "kobject debugging"
diff --git a/lib/assoc_array.c b/lib/assoc_array.c
index c0b1007011e1..2404d03e251a 100644
--- a/lib/assoc_array.c
+++ b/lib/assoc_array.c
@@ -1723,11 +1723,13 @@ ascend_old_tree:
1723 shortcut = assoc_array_ptr_to_shortcut(ptr); 1723 shortcut = assoc_array_ptr_to_shortcut(ptr);
1724 slot = shortcut->parent_slot; 1724 slot = shortcut->parent_slot;
1725 cursor = shortcut->back_pointer; 1725 cursor = shortcut->back_pointer;
1726 if (!cursor)
1727 goto gc_complete;
1726 } else { 1728 } else {
1727 slot = node->parent_slot; 1729 slot = node->parent_slot;
1728 cursor = ptr; 1730 cursor = ptr;
1729 } 1731 }
1730 BUG_ON(!ptr); 1732 BUG_ON(!cursor);
1731 node = assoc_array_ptr_to_node(cursor); 1733 node = assoc_array_ptr_to_node(cursor);
1732 slot++; 1734 slot++;
1733 goto continue_node; 1735 goto continue_node;
@@ -1735,7 +1737,7 @@ ascend_old_tree:
1735gc_complete: 1737gc_complete:
1736 edit->set[0].to = new_root; 1738 edit->set[0].to = new_root;
1737 assoc_array_apply_edit(edit); 1739 assoc_array_apply_edit(edit);
1738 edit->array->nr_leaves_on_tree = nr_leaves_on_tree; 1740 array->nr_leaves_on_tree = nr_leaves_on_tree;
1739 return 0; 1741 return 0;
1740 1742
1741enomem: 1743enomem:
diff --git a/lib/hweight.c b/lib/hweight.c
index b7d81ba143d1..9a5c1f221558 100644
--- a/lib/hweight.c
+++ b/lib/hweight.c
@@ -11,7 +11,7 @@
11 11
12unsigned int __sw_hweight32(unsigned int w) 12unsigned int __sw_hweight32(unsigned int w)
13{ 13{
14#ifdef ARCH_HAS_FAST_MULTIPLIER 14#ifdef CONFIG_ARCH_HAS_FAST_MULTIPLIER
15 w -= (w >> 1) & 0x55555555; 15 w -= (w >> 1) & 0x55555555;
16 w = (w & 0x33333333) + ((w >> 2) & 0x33333333); 16 w = (w & 0x33333333) + ((w >> 2) & 0x33333333);
17 w = (w + (w >> 4)) & 0x0f0f0f0f; 17 w = (w + (w >> 4)) & 0x0f0f0f0f;
@@ -49,7 +49,7 @@ unsigned long __sw_hweight64(__u64 w)
49 return __sw_hweight32((unsigned int)(w >> 32)) + 49 return __sw_hweight32((unsigned int)(w >> 32)) +
50 __sw_hweight32((unsigned int)w); 50 __sw_hweight32((unsigned int)w);
51#elif BITS_PER_LONG == 64 51#elif BITS_PER_LONG == 64
52#ifdef ARCH_HAS_FAST_MULTIPLIER 52#ifdef CONFIG_ARCH_HAS_FAST_MULTIPLIER
53 w -= (w >> 1) & 0x5555555555555555ul; 53 w -= (w >> 1) & 0x5555555555555555ul;
54 w = (w & 0x3333333333333333ul) + ((w >> 2) & 0x3333333333333333ul); 54 w = (w & 0x3333333333333333ul) + ((w >> 2) & 0x3333333333333333ul);
55 w = (w + (w >> 4)) & 0x0f0f0f0f0f0f0f0ful; 55 w = (w + (w >> 4)) & 0x0f0f0f0f0f0f0f0ful;
diff --git a/lib/percpu-refcount.c b/lib/percpu-refcount.c
index 559ee0b20318..c6c31e2829b1 100644
--- a/lib/percpu-refcount.c
+++ b/lib/percpu-refcount.c
@@ -189,3 +189,19 @@ void percpu_ref_kill_and_confirm(struct percpu_ref *ref,
189 call_rcu_sched(&ref->rcu, percpu_ref_kill_rcu); 189 call_rcu_sched(&ref->rcu, percpu_ref_kill_rcu);
190} 190}
191EXPORT_SYMBOL_GPL(percpu_ref_kill_and_confirm); 191EXPORT_SYMBOL_GPL(percpu_ref_kill_and_confirm);
192
193/*
194 * XXX: Temporary kludge to work around SCSI blk-mq stall. Used only by
195 * block/blk-mq.c::blk_mq_freeze_queue(). Will be removed during v3.18
196 * devel cycle. Do not use anywhere else.
197 */
198void __percpu_ref_kill_expedited(struct percpu_ref *ref)
199{
200 WARN_ONCE(ref->pcpu_count_ptr & PCPU_REF_DEAD,
201 "percpu_ref_kill() called more than once on %pf!",
202 ref->release);
203
204 ref->pcpu_count_ptr |= PCPU_REF_DEAD;
205 synchronize_sched_expedited();
206 percpu_ref_kill_rcu(&ref->rcu);
207}
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index a2c78810ebc1..7b36e4d40ed7 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -23,7 +23,6 @@
23#include <linux/hash.h> 23#include <linux/hash.h>
24#include <linux/random.h> 24#include <linux/random.h>
25#include <linux/rhashtable.h> 25#include <linux/rhashtable.h>
26#include <linux/log2.h>
27 26
28#define HASH_DEFAULT_SIZE 64UL 27#define HASH_DEFAULT_SIZE 64UL
29#define HASH_MIN_SIZE 4UL 28#define HASH_MIN_SIZE 4UL
diff --git a/lib/string.c b/lib/string.c
index 992bf30af759..f3c6ff596414 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -807,9 +807,9 @@ void *memchr_inv(const void *start, int c, size_t bytes)
807 return check_bytes8(start, value, bytes); 807 return check_bytes8(start, value, bytes);
808 808
809 value64 = value; 809 value64 = value;
810#if defined(ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64 810#if defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64
811 value64 *= 0x0101010101010101; 811 value64 *= 0x0101010101010101;
812#elif defined(ARCH_HAS_FAST_MULTIPLIER) 812#elif defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER)
813 value64 *= 0x01010101; 813 value64 *= 0x01010101;
814 value64 |= value64 << 32; 814 value64 |= value64 << 32;
815#else 815#else