2022-06-07 11:17:47

by Muchun Song

[permalink] [raw]
Subject: [PATCH v2] tcp: use alloc_large_system_hash() to allocate table_perturb

In our server, there may be no high order (>= 6) memory since we reserve
lots of HugeTLB pages when booting. Then the system panic. So use
alloc_large_system_hash() to allocate table_perturb.

Fixes: e9261476184b ("tcp: dynamically allocate the perturb table used by source ports")
Signed-off-by: Muchun Song <[email protected]>
---
v2:
- Add Fixes tag and replace kvmalloc_array with alloc_large_system_hash suggested
by Eric Dumazet.

net/ipv4/inet_hashtables.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index e8de5e699b3f..545f91b6cb5e 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -1026,10 +1026,12 @@ void __init inet_hashinfo2_init(struct inet_hashinfo *h, const char *name,
init_hashinfo_lhash2(h);

/* this one is used for source ports of outgoing connections */
- table_perturb = kmalloc_array(INET_TABLE_PERTURB_SIZE,
- sizeof(*table_perturb), GFP_KERNEL);
- if (!table_perturb)
- panic("TCP: failed to alloc table_perturb");
+ table_perturb = alloc_large_system_hash("Table-perturb",
+ sizeof(*table_perturb),
+ INET_TABLE_PERTURB_SIZE,
+ 0, 0, NULL, NULL,
+ INET_TABLE_PERTURB_SIZE,
+ INET_TABLE_PERTURB_SIZE);
}

int inet_hashinfo2_init_mod(struct inet_hashinfo *h)
--
2.11.0


2022-06-09 04:48:35

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH v2] tcp: use alloc_large_system_hash() to allocate table_perturb

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

On Tue, 7 Jun 2022 15:02:14 +0800 you wrote:
> In our server, there may be no high order (>= 6) memory since we reserve
> lots of HugeTLB pages when booting. Then the system panic. So use
> alloc_large_system_hash() to allocate table_perturb.
>
> Fixes: e9261476184b ("tcp: dynamically allocate the perturb table used by source ports")
> Signed-off-by: Muchun Song <[email protected]>
>
> [...]

Here is the summary with links:
- [v2] tcp: use alloc_large_system_hash() to allocate table_perturb
https://git.kernel.org/netdev/net/c/e67b72b90b7e

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html


2022-06-09 05:47:46

by Eric Dumazet

[permalink] [raw]
Subject: Re: [PATCH v2] tcp: use alloc_large_system_hash() to allocate table_perturb

On Tue, Jun 7, 2022 at 12:02 AM Muchun Song <[email protected]> wrote:
>
> In our server, there may be no high order (>= 6) memory since we reserve
> lots of HugeTLB pages when booting. Then the system panic. So use
> alloc_large_system_hash() to allocate table_perturb.
>
> Fixes: e9261476184b ("tcp: dynamically allocate the perturb table used by source ports")
> Signed-off-by: Muchun Song <[email protected]>
> ---
> v2:
> - Add Fixes tag and replace kvmalloc_array with alloc_large_system_hash suggested
> by Eric Dumazet.
>

Reviewed-by: Eric Dumazet <[email protected]>

Thanks.