aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCatalina Mocanu <catalina.mocanu@gmail.com>2014-10-27 23:24:19 +0200
committerJosh Triplett <josh@joshtriplett.org>2014-11-05 10:23:36 -0800
commit4ecea0db79ef65a425e4251a6b6a50f68fec08e6 (patch)
tree01b3fab0d21a71afd09e93d087b97e6295cfdf70
parentf114040e3ea6e07372334ade75d1ee0775c355e1 (diff)
downloadlinux-tiny/no-rhashtable.tar.gz
lib: rhashtable: Make rhashtable.c optionaltiny/no-rhashtable
Add a new config option CONFIG_RHASHTABLE to compile out relativistic hash table functionality. This new config is not visible to the user. Since rhashtables are used in the networking subsytem, config RHASHTABLE is selected by config NET and config NFT_HASH. bloat-o-meter output: add/remove: 0/16 grow/shrink: 0/0 up/down: 0/-1086 (-1086) function old new delta head_hashfn 5 - -5 rhashtable_obj_hashfn 6 - -6 rhashtable_destroy 7 - -7 rht_grow_above_75 13 - -13 rht_shrink_below_30 23 - -23 rhashtable_hashfn 24 - -24 obj_hashfn 41 - -41 bucket_table_alloc 41 - -41 rhashtable_remove_pprev 48 - -48 rhashtable_lookup_compare 59 - -59 rhashtable_remove 63 - -63 rhashtable_insert 67 - -67 rhashtable_lookup 71 - -71 rhashtable_shrink 103 - -103 rhashtable_init 195 - -195 rhashtable_expand 320 - -320 Signed-off-by: Catalina Mocanu <catalina.mocanu@gmail.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Josh Triplett <josh@joshtriplett.org>
-rw-r--r--include/linux/rhashtable.h2
-rw-r--r--lib/Kconfig3
-rw-r--r--lib/Makefile3
-rw-r--r--net/Kconfig1
-rw-r--r--net/netfilter/Kconfig1
5 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index fb298e9d6d3a8e..91ed736c8c463f 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -82,6 +82,7 @@ struct rhashtable {
struct rhashtable_params p;
};
+#ifdef CONFIG_RHASHTABLE
#ifdef CONFIG_PROVE_LOCKING
int lockdep_rht_mutex_is_held(const struct rhashtable *ht);
#else
@@ -112,6 +113,7 @@ void *rhashtable_lookup_compare(const struct rhashtable *ht, u32 hash,
bool (*compare)(void *, void *), void *arg);
void rhashtable_destroy(const struct rhashtable *ht);
+#endif /* CONFIG_RHASHTABLE */
#define rht_dereference(p, ht) \
rcu_dereference_protected(p, lockdep_rht_mutex_is_held(ht))
diff --git a/lib/Kconfig b/lib/Kconfig
index 54cf309a92a5ed..f061bd06418ef8 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -54,6 +54,9 @@ config ARCH_USE_CMPXCHG_LOCKREF
config ARCH_HAS_FAST_MULTIPLIER
bool
+config RHASHTABLE
+ bool
+
config CRC_CCITT
tristate "CRC-CCITT functions"
help
diff --git a/lib/Makefile b/lib/Makefile
index 7512dc978f1872..b51ffad0beaf5f 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -26,7 +26,8 @@ obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \
bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \
gcd.o lcm.o list_sort.o uuid.o flex_array.o iovec.o clz_ctz.o \
bsearch.o find_last_bit.o find_next_bit.o llist.o memweight.o kfifo.o \
- percpu-refcount.o percpu_ida.o hash.o rhashtable.o
+ percpu-refcount.o percpu_ida.o hash.o
+obj-$(CONFIG_RHASHTABLE) += rhashtable.o
obj-y += string_helpers.o
obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o
obj-y += kstrtox.o
diff --git a/net/Kconfig b/net/Kconfig
index 6272420a721b0f..02badd46823f09 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -7,6 +7,7 @@ menuconfig NET
select NLATTR
select GENERIC_NET_UTILS
select ANON_INODES
+ select RHASHTABLE
---help---
Unless you really know what you are doing, you should say Y here.
The reason is that some programs need kernel networking support even
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index ae5096ab65eb54..e2ca9f894af712 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -470,6 +470,7 @@ config NFT_RBTREE
config NFT_HASH
depends on NF_TABLES
+ select RHASHTABLE
tristate "Netfilter nf_tables hash set module"
help
This option adds the "hash" set type that is used to build one-way