From: Andi Kleen <redacted>
Just make the FIB hash tables much smaller for small
kernel.
Signed-off-by: Andi Kleen <redacted>
---
include/net/ip_fib.h | 5 +++++
net/ipv4/fib_semantics.c | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 9922093..cbe60cd 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -65,7 +65,11 @@ struct fnhe_hash_bucket {
struct fib_nh_exception __rcu *chain;
};
+#ifdef CONFIG_BASE_SMALL
+#define FNHE_HASH_SIZE 16
+#else
#define FNHE_HASH_SIZE 2048
+#endif
#define FNHE_RECLAIM_DEPTH 5
struct fib_nh {@@ -162,6 +166,7 @@ struct fib_result_nl {
#ifdef CONFIG_IP_MULTIPLE_TABLES
#define FIB_TABLE_HASHSZ 256
#else
+/* Can we use 1 for BASE_SMALL? */
#define FIB_TABLE_HASHSZ 2
#endif
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 8a043f0..c3d4e4d 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -51,7 +51,11 @@ static struct hlist_head *fib_info_laddrhash;
static unsigned int fib_info_hash_size;
static unsigned int fib_info_cnt;
+#ifdef CONFIG_BASE_SMALL
+#define DEVINDEX_HASHBITS 2
+#else
#define DEVINDEX_HASHBITS 8
+#endif
#define DEVINDEX_HASHSIZE (1U << DEVINDEX_HASHBITS)
static struct hlist_head fib_info_devhash[DEVINDEX_HASHSIZE];
--
1.9.0