From: Eric Dumazet <eric.dumazet@gmail.com>
To: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: netdev@vger.kernel.org, yannick@koehler.name,
xiyou.wangcong@gmail.com, davem@davemloft.net
Subject: Re: [PATCH RFC] unix: account skb memory to receiving socket's sk_rmem_alloc on sending
Date: Tue, 26 Mar 2013 08:53:38 -0700 [thread overview]
Message-ID: <1364313218.1716.37.camel@edumazet-glaptop> (raw)
In-Reply-To: <20130326001740.GB29705@order.stressinduktion.org>
On Tue, 2013-03-26 at 01:17 +0100, Hannes Frederic Sowa wrote:
> This is the newest version of this patch. I only stripped out the setting
> of the SOCK_USE_WRITE_QUEUE socket flag (I was unsure if otherwise
> sock_wfree needed the socket lock but I am pretty confident that is
> is not needed). Perhaps someone finds some time to have a look at this
> patch. Also, if you come up with things my test case does not cover yet
> please let me know and I will catch up with the tests.
>
> Patch is based on net-next.
>
> Thanks!
>
> [PATCH RFC] unix: account skb memory to receiving socket's sk_rmem_alloc on sending
>
> In case of unix datagram sockets, skb memory was only accounted in the
> sending socket's sk_wmem_alloc. Hence, if one receiver would stop to
> receive frames on its socket, the sending socket's send buffer space
> could get exhausted and the socket would block sending datagrams to
> other destionations, too.
>
> This patch places the refcounted peer's unix address for AF_UNIX
> SOCK_DGRAM sockets into the skb's UNIXCB. So a reference from the skb
> to the receiving struct sock can be set and so enables to do proper skb
> destructor handling for rmem and wmem. Buffer memory is then accounted
> to the receiving socket. If the socket rmem is exhausted the normal
> blocking and timeout behaviour kicks in.
>
> Resource exhausion protection for unix dgram sockets is now based
> only on sockets rmem checking. Unix dgram sockets do not rely on
> sk_max_ack_backlog anymore. The controls for this are
> /proc/sys/net/core/{r,w}mem_{default,max}.
>
> This patch also changes the reporting of unix dgram rqueue size, as it
> now reports not only the size of the first fragment but the amount of
> readable memory for the socket.
>
> Based on the patches from Yannick Koehler and Cong Wang.
This opens the possibility of a sender to flood a receiver, instead of
being blocked by its own sndbuf.
Do we want such regression ? How many applications might rely on
existing behavior ?
Its not clear what is the appropriate way to handle this.
next prev parent reply other threads:[~2013-03-26 15:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-04 23:14 [PATCH RFC] unix: account skb memory to receiving socket's sk_rmem_alloc on sending Hannes Frederic Sowa
2013-03-09 21:43 ` Hannes Frederic Sowa
2013-03-10 4:31 ` Eric Dumazet
2013-03-10 4:40 ` Hannes Frederic Sowa
2013-03-11 19:37 ` Hannes Frederic Sowa
2013-03-26 0:17 ` Hannes Frederic Sowa
2013-03-26 15:53 ` Eric Dumazet [this message]
2013-03-26 16:42 ` Hannes Frederic Sowa
2013-04-07 22:47 ` Hannes Frederic Sowa
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=1364313218.1716.37.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=hannes@stressinduktion.org \
--cc=netdev@vger.kernel.org \
--cc=xiyou.wangcong@gmail.com \
--cc=yannick@koehler.name \
/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