From: Eric Dumazet <eric.dumazet@gmail.com>
To: Hagen Paul Pfeifer <hagen@jauu.net>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 2/2] socket: add minimum listen queue length sysctl
Date: Mon, 21 Mar 2011 08:36:30 +0100 [thread overview]
Message-ID: <1300692990.2831.485.camel@edumazet-laptop> (raw)
In-Reply-To: <1300662282-24741-2-git-send-email-hagen@jauu.net>
Le lundi 21 mars 2011 à 00:04 +0100, Hagen Paul Pfeifer a écrit :
> In the case that a server programmer misjudge network characteristic the
> backlog parameter for listen(2) may not adequate to utilize hosts
> capabilities and lead to unrequired SYN retransmission - a small backlog
> value can form an artificial limitation. From Erics server setup, a
> listen queue length of 8 is often a way to small):
>
> ss -a | head
> State Recv-Q Send-Q Local Address:Port Peer
> Address:Port
> LISTEN 0 8 *:imaps *:*
> LISTEN 0 8 *:pop3s *:*
> LISTEN 0 50 *:mysql *:*
> LISTEN 0 8 *:pop3 *:*
> LISTEN 0 8 *:imap2 *:*
> LISTEN 0 511 *:www *:*
>
> Until now it is not possible for the system (network) administrator to
> increase this value. A bug report must be filled, the backlog increased,
> a new version released or even worse: if using closed source software
> you cannot make anything.
>
> sysctl_min_syn_backlog provides the ability to increase the minimum
> queue length. The default is 8.
>
> Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
>
> ---
> I will spin a second documentation patch if Davem accept this patch.
> ---
> include/net/request_sock.h | 1 +
> net/core/request_sock.c | 5 ++++-
> net/ipv4/sysctl_net_ipv4.c | 7 +++++++
> 3 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/include/net/request_sock.h b/include/net/request_sock.h
> index 99e6e19..3e8865f 100644
> --- a/include/net/request_sock.h
> +++ b/include/net/request_sock.h
> @@ -89,6 +89,7 @@ static inline void reqsk_free(struct request_sock *req)
> }
>
> extern int sysctl_max_syn_backlog;
> +extern int sysctl_min_syn_backlog;
>
> /** struct listen_sock - listen state
> *
> diff --git a/net/core/request_sock.c b/net/core/request_sock.c
> index 182236b..e937e9c 100644
> --- a/net/core/request_sock.c
> +++ b/net/core/request_sock.c
> @@ -35,6 +35,9 @@
> int sysctl_max_syn_backlog = 256;
> EXPORT_SYMBOL(sysctl_max_syn_backlog);
>
> +int sysctl_min_syn_backlog = 8;
> +EXPORT_SYMBOL(sysctl_min_syn_backlog);
> +
> int reqsk_queue_alloc(struct request_sock_queue *queue,
> unsigned int nr_table_entries)
> {
> @@ -42,7 +45,7 @@ int reqsk_queue_alloc(struct request_sock_queue *queue,
> struct listen_sock *lopt;
>
> nr_table_entries = min_t(u32, nr_table_entries, sysctl_max_syn_backlog);
> - nr_table_entries = max_t(u32, nr_table_entries, 8);
> + nr_table_entries = max_t(u32, nr_table_entries, sysctl_min_syn_backlog);
> nr_table_entries = roundup_pow_of_two(nr_table_entries + 1);
> lopt_size += nr_table_entries * sizeof(struct request_sock *);
> if (lopt_size > PAGE_SIZE)
I believe you are mistaken.
The code you change is the code sizing the hash table, not
sk->sk_max_ack_backlog
This only matters if one application is able to change its listen
backlog during its lifetime.
Say, it begins with :
listen(fd, 1);
Then, a bit later :
listen(fd, 8192);
This certainly is very unlikely...
With current kernel, it does change the maximum SYN_RECV sockets in
flight, but hash table is not resized and stay with 8 slots, so
performance might be suboptimal, since chains are going to hold 1024
elements.
next prev parent reply other threads:[~2011-03-21 7:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-20 1:50 [PATCH] socket: increase default maximum listen queue length Hagen Paul Pfeifer
2011-03-20 4:41 ` David Miller
2011-03-20 11:59 ` Hagen Paul Pfeifer
2011-03-20 8:30 ` Eric Dumazet
2011-03-20 9:04 ` Rémi Denis-Courmont
2011-03-20 9:36 ` Eric Dumazet
2011-03-20 11:39 ` Hagen Paul Pfeifer
2011-03-20 11:55 ` Eric Dumazet
2011-03-20 12:14 ` Hagen Paul Pfeifer
2011-03-20 23:04 ` [PATCH 1/2] " Hagen Paul Pfeifer
2011-03-20 23:04 ` [PATCH 2/2] socket: add minimum listen queue length sysctl Hagen Paul Pfeifer
2011-03-21 7:36 ` Eric Dumazet [this message]
2011-03-20 23:09 ` [PATCH 1/2] socket: increase default maximum listen queue length David Miller
2011-03-20 23:52 ` Hagen Paul Pfeifer
2011-03-21 0:18 ` David Miller
2011-03-20 23:57 ` Hagen Paul Pfeifer
-- strict thread matches above, loose matches on Subject: below --
2011-03-25 18:31 Hagen Paul Pfeifer
2011-03-25 18:31 ` [PATCH 2/2] socket: add minimum listen queue length sysctl Hagen Paul Pfeifer
2011-03-25 20:24 ` Rick Jones
2011-03-25 23:51 ` Hagen Paul Pfeifer
2011-03-26 0:21 ` Rick Jones
2011-03-26 7:06 ` Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1300692990.2831.485.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=hagen@jauu.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox