661-kernel-ct-size-the-hashtable-more-adequately.patch 1006 B

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