From: David Miller <davem@davemloft.net>
To: dada1@cosmosbay.com
Cc: haoki@redhat.com, herbert@gondor.apana.org.au,
netdev@vger.kernel.org, tyasui@redhat.com, mhiramat@redhat.com,
satoshi.oshima.fk@hitachi.com, billfink@mindspring.com,
andi@firstfloor.org, johnpol@2ka.mipt.ru,
shemminger@linux-foundation.org, yoshfuji@linux-ipv6.org,
yumiko.sugita.yf@hitachi.com
Subject: Re: [PATCH 1/3] [UDP]: add udp_mem, udp_rmem_min and udp_wmem_min
Date: Thu, 10 Jan 2008 22:00:15 -0800 (PST) [thread overview]
Message-ID: <20080110.220015.118987509.davem@davemloft.net> (raw)
In-Reply-To: <4778FFE2.9090008@cosmosbay.com>
From: Eric Dumazet <dada1@cosmosbay.com>
Date: Mon, 31 Dec 2007 15:42:42 +0100
> Maybe we need to introduce some mechanism to let sk_forward between 0 and
> SK_MEM_QUANTUM (inclusive).
>
> static inline void sk_mem_reclaim_overpage(struct sock *sk)
> {
> if (sk->sk_forward_alloc > SK_MEM_QUANTUM) {
> __sk_mem_reclaim(sk);
> }
> }
>
> and use sk_mem_reclaim_overpage() instead of sk_mem_reclaim() in
> tcp_delack_timer() ?
This makes a lot of sense to me, it is definitely doing the wrong
thing here for the load you describe.
I've applied the following to net-2.6.25 and I am definitely
willing to put this into 2.6.24 and -stable if you think that's
worthwhile too.
[TCP]: Do not purge sk_forward_alloc entirely in tcp_delack_timer().
Otherwise we beat heavily on the global tcp_memory atomics
when all of the sockets in the system are slowly sending
perioding packet clumps.
Noticed and suggested by Eric Dumazet.
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/sock.h | 8 ++++++++
net/ipv4/tcp_timer.c | 2 +-
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index 89e04e4..d24b826 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -759,6 +759,14 @@ static inline void sk_mem_reclaim(struct sock *sk)
__sk_mem_reclaim(sk);
}
+static inline void sk_mem_reclaim_partial(struct sock *sk)
+{
+ if (!sk_has_account(sk))
+ return;
+ if (sk->sk_forward_alloc > SK_MEM_QUANTUM)
+ __sk_mem_reclaim(sk);
+}
+
static inline void sk_mem_charge(struct sock *sk, int size)
{
if (!sk_has_account(sk))
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 17931be..803d758 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -186,7 +186,7 @@ static void tcp_delack_timer(unsigned long data)
goto out_unlock;
}
- sk_mem_reclaim(sk);
+ sk_mem_reclaim_partial(sk);
if (sk->sk_state == TCP_CLOSE || !(icsk->icsk_ack.pending & ICSK_ACK_TIMER))
goto out;
--
1.5.4.rc2.84.gf85fd
next prev parent reply other threads:[~2008-01-11 6:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-30 8:57 [PATCH 0/3] UDP memory accounting and limitation (take 12) Hideo AOKI
2007-12-30 9:01 ` [PATCH 1/3] [UDP]: add udp_mem, udp_rmem_min and udp_wmem_min Hideo AOKI
2007-12-31 8:19 ` David Miller
2007-12-31 8:54 ` Eric Dumazet
2007-12-31 9:11 ` Herbert Xu
2007-12-31 12:13 ` David Miller
2007-12-31 14:42 ` Eric Dumazet
2008-01-11 6:00 ` David Miller [this message]
2007-12-31 18:58 ` Hideo AOKI
2007-12-30 9:02 ` [PATCH 2/3] [UDP]: memory accounting in IPv4 Hideo AOKI
2007-12-30 9:28 ` Eric Dumazet
2007-12-31 18:43 ` Hideo AOKI
2007-12-31 18:58 ` Eric Dumazet
2007-12-30 9:02 ` [PATCH 3/3] [UDP]: memory accounting in IPv6 Hideo AOKI
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=20080110.220015.118987509.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=andi@firstfloor.org \
--cc=billfink@mindspring.com \
--cc=dada1@cosmosbay.com \
--cc=haoki@redhat.com \
--cc=herbert@gondor.apana.org.au \
--cc=johnpol@2ka.mipt.ru \
--cc=mhiramat@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=satoshi.oshima.fk@hitachi.com \
--cc=shemminger@linux-foundation.org \
--cc=tyasui@redhat.com \
--cc=yoshfuji@linux-ipv6.org \
--cc=yumiko.sugita.yf@hitachi.com \
/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;
as well as URLs for NNTP newsgroup(s).