Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipvs: increase ip_vs_conn_tab_bits range for 64BIT

Current range [8, 20] is set purely due to historical reasons
because at the time, ~1M (2^20) was considered sufficient.
With this change, 27 is the upper limit for 64-bit, 20 otherwise.

Previous change regarding this limit is here.

Link: https://lore.kernel.org/all/86eabeb9dd62aebf1e2533926fdd13fed48bab1f.1631289960.git.aclaudi@redhat.com/T/#u

Signed-off-by: Abhijeet Rastogi <abhijeet.1989@gmail.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Acked-by: Simon Horman <horms@kernel.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

Abhijeet Rastogi and committed by
Pablo Neira Ayuso
04292c69 4ff3dfc9

+16 -15
+14 -13
net/netfilter/ipvs/Kconfig
··· 44 44 45 45 config IP_VS_TAB_BITS 46 46 int "IPVS connection table size (the Nth power of 2)" 47 - range 8 20 47 + range 8 20 if !64BIT 48 + range 8 27 if 64BIT 48 49 default 12 49 50 help 50 51 The IPVS connection hash table uses the chaining scheme to handle ··· 55 54 56 55 Note the table size must be power of 2. The table size will be the 57 56 value of 2 to the your input number power. The number to choose is 58 - from 8 to 20, the default number is 12, which means the table size 59 - is 4096. Don't input the number too small, otherwise you will lose 60 - performance on it. You can adapt the table size yourself, according 61 - to your virtual server application. It is good to set the table size 62 - not far less than the number of connections per second multiplying 63 - average lasting time of connection in the table. For example, your 64 - virtual server gets 200 connections per second, the connection lasts 65 - for 200 seconds in average in the connection table, the table size 66 - should be not far less than 200x200, it is good to set the table 67 - size 32768 (2**15). 57 + from 8 to 27 for 64BIT(20 otherwise), the default number is 12, 58 + which means the table size is 4096. Don't input the number too 59 + small, otherwise you will lose performance on it. You can adapt the 60 + table size yourself, according to your virtual server application. 61 + It is good to set the table size not far less than the number of 62 + connections per second multiplying average lasting time of 63 + connection in the table. For example, your virtual server gets 200 64 + connections per second, the connection lasts for 200 seconds in 65 + average in the connection table, the table size should be not far 66 + less than 200x200, it is good to set the table size 32768 (2**15). 68 67 69 68 Another note that each connection occupies 128 bytes effectively and 70 69 each hash entry uses 8 bytes, so you can estimate how much memory is 71 70 needed for your box. 72 71 73 72 You can overwrite this number setting conn_tab_bits module parameter 74 - or by appending ip_vs.conn_tab_bits=? to the kernel command line 75 - if IP VS was compiled built-in. 73 + or by appending ip_vs.conn_tab_bits=? to the kernel command line if 74 + IP VS was compiled built-in. 76 75 77 76 comment "IPVS transport protocol load balancing support" 78 77
+2 -2
net/netfilter/ipvs/ip_vs_conn.c
··· 1485 1485 int idx; 1486 1486 1487 1487 /* Compute size and mask */ 1488 - if (ip_vs_conn_tab_bits < 8 || ip_vs_conn_tab_bits > 20) { 1489 - pr_info("conn_tab_bits not in [8, 20]. Using default value\n"); 1488 + if (ip_vs_conn_tab_bits < 8 || ip_vs_conn_tab_bits > 27) { 1489 + pr_info("conn_tab_bits not in [8, 27]. Using default value\n"); 1490 1490 ip_vs_conn_tab_bits = CONFIG_IP_VS_TAB_BITS; 1491 1491 } 1492 1492 ip_vs_conn_tab_size = 1 << ip_vs_conn_tab_bits;