kernel: bump 5.15 to 5.15.34
[openwrt/staging/chunkeey.git] / target / linux / generic / hack-5.15 / 661-kernel-ct-size-the-hashtable-more-adequately.patch
1 From 804fbb3f2ec9283f7b778e057a68bfff440a0be6 Mon Sep 17 00:00:00 2001
2 From: Rui Salvaterra <rsalvaterra@gmail.com>
3 Date: Wed, 30 Mar 2022 22:51:55 +0100
4 Subject: [PATCH] kernel: ct: size the hashtable more adequately
5
6 To set the default size of the connection tracking hash table, a divider of
7 16384 becomes inadequate for a router handling lots of connections. Divide by
8 2048 instead, making the default size scale better with the available RAM.
9
10 Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
11 ---
12 net/netfilter/nf_conntrack_core.c | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-)
14
15 --- a/net/netfilter/nf_conntrack_core.c
16 +++ b/net/netfilter/nf_conntrack_core.c
17 @@ -2727,7 +2727,7 @@ int nf_conntrack_init_start(void)
18
19 if (!nf_conntrack_htable_size) {
20 nf_conntrack_htable_size
21 - = (((nr_pages << PAGE_SHIFT) / 16384)
22 + = (((nr_pages << PAGE_SHIFT) / 2048)
23 / sizeof(struct hlist_head));
24 if (BITS_PER_LONG >= 64 &&
25 nr_pages > (4 * (1024 * 1024 * 1024 / PAGE_SIZE)))