Skip to content

Commit bee015e

Browse files
shadyabhiroxanan1996
authored andcommitted
ipvs: increase ip_vs_conn_tab_bits range for 64BIT
BugLink: https://bugs.launchpad.net/bugs/2034469 commit 04292c6 upstream. 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 <[email protected]> Acked-by: Julian Anastasov <[email protected]> Acked-by: Simon Horman <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]> Cc: Allen Pais <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Kamal Mostafa <[email protected]> Signed-off-by: Stefan Bader <[email protected]>
1 parent ed7cbb8 commit bee015e

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

net/netfilter/ipvs/Kconfig

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ config IP_VS_DEBUG
4444

4545
config IP_VS_TAB_BITS
4646
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
4849
default 12
4950
help
5051
The IPVS connection hash table uses the chaining scheme to handle
@@ -54,24 +55,24 @@ config IP_VS_TAB_BITS
5455

5556
Note the table size must be power of 2. The table size will be the
5657
value of 2 to the your input number power. The number to choose is
57-
from 8 to 20, the default number is 12, which means the table size
58-
is 4096. Don't input the number too small, otherwise you will lose
59-
performance on it. You can adapt the table size yourself, according
60-
to your virtual server application. It is good to set the table size
61-
not far less than the number of connections per second multiplying
62-
average lasting time of connection in the table. For example, your
63-
virtual server gets 200 connections per second, the connection lasts
64-
for 200 seconds in average in the connection table, the table size
65-
should be not far less than 200x200, it is good to set the table
66-
size 32768 (2**15).
58+
from 8 to 27 for 64BIT(20 otherwise), the default number is 12,
59+
which means the table size is 4096. Don't input the number too
60+
small, otherwise you will lose performance on it. You can adapt the
61+
table size yourself, according to your virtual server application.
62+
It is good to set the table size not far less than the number of
63+
connections per second multiplying average lasting time of
64+
connection in the table. For example, your virtual server gets 200
65+
connections per second, the connection lasts for 200 seconds in
66+
average in the connection table, the table size should be not far
67+
less than 200x200, it is good to set the table size 32768 (2**15).
6768

6869
Another note that each connection occupies 128 bytes effectively and
6970
each hash entry uses 8 bytes, so you can estimate how much memory is
7071
needed for your box.
7172

7273
You can overwrite this number setting conn_tab_bits module parameter
73-
or by appending ip_vs.conn_tab_bits=? to the kernel command line
74-
if IP VS was compiled built-in.
74+
or by appending ip_vs.conn_tab_bits=? to the kernel command line if
75+
IP VS was compiled built-in.
7576

7677
comment "IPVS transport protocol load balancing support"
7778

net/netfilter/ipvs/ip_vs_conn.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,8 +1484,8 @@ int __init ip_vs_conn_init(void)
14841484
int idx;
14851485

14861486
/* Compute size and mask */
1487-
if (ip_vs_conn_tab_bits < 8 || ip_vs_conn_tab_bits > 20) {
1488-
pr_info("conn_tab_bits not in [8, 20]. Using default value\n");
1487+
if (ip_vs_conn_tab_bits < 8 || ip_vs_conn_tab_bits > 27) {
1488+
pr_info("conn_tab_bits not in [8, 27]. Using default value\n");
14891489
ip_vs_conn_tab_bits = CONFIG_IP_VS_TAB_BITS;
14901490
}
14911491
ip_vs_conn_tab_size = 1 << ip_vs_conn_tab_bits;

0 commit comments

Comments
 (0)