lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240327192934.6843-1-kuniyu@amazon.com>
Date: Wed, 27 Mar 2024 12:29:34 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <edumazet@...gle.com>
CC: <davem@...emloft.net>, <eric.dumazet@...il.com>, <kuba@...nel.org>,
	<netdev@...r.kernel.org>, <pabeni@...hat.com>, Kuniyuki Iwashima
	<kuniyu@...zon.com>
Subject: Re: [PATCH net-next] tcp/dccp: bypass empty buckets in inet_twsk_purge()

From: Eric Dumazet <edumazet@...gle.com>
Date: Wed, 27 Mar 2024 19:12:06 +0000
> TCP ehash table is often sparsely populated.
> 
> inet_twsk_purge() spends too much time calling cond_resched().
> 
> This patch can reduce time spent in inet_twsk_purge() by 20x.
> 
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>

Sounds good!

Reviewed-by: Kuniyuki Iwashima <kuniyu@...zon.com>

1 nit below.


> ---
>  net/ipv4/inet_timewait_sock.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c
> index e8de45d34d56a507a4bdcceaccbd5707692b6c0a..b0cc07d9a568c5dc52bd29729862bcb03e5d595d 100644
> --- a/net/ipv4/inet_timewait_sock.c
> +++ b/net/ipv4/inet_timewait_sock.c
> @@ -266,12 +266,17 @@ EXPORT_SYMBOL_GPL(__inet_twsk_schedule);
>  /* Remove all non full sockets (TIME_WAIT and NEW_SYN_RECV) for dead netns */
>  void inet_twsk_purge(struct inet_hashinfo *hashinfo, int family)
>  {
> +	struct inet_ehash_bucket *head = &hashinfo->ehash[0];
> +	unsigned int ehash_mask = hashinfo->ehash_mask;
>  	struct hlist_nulls_node *node;
>  	unsigned int slot;
>  	struct sock *sk;
>  
> -	for (slot = 0; slot <= hashinfo->ehash_mask; slot++) {
> -		struct inet_ehash_bucket *head = &hashinfo->ehash[slot];
> +	for (slot = 0; slot <= ehash_mask; slot++, head++) {
> +

unnecessary blank link here.

Thanks!

> +		if (hlist_nulls_empty(&head->chain))
> +			continue;
> +
>  restart_rcu:
>  		cond_resched();
>  		rcu_read_lock();
> -- 
> 2.44.0.396.g6e790dbe36-goog
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ