From: David Howells <dhowells@redhat.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
herbert.xu@redhat.com, linux-kernel@vger.kernel.org,
hch@infradead.org, arjan@infradead.org, dhowells@redhat.com
Subject: Re: [PATCH 0/5] [RFC] AF_RXRPC socket family implementation [try #3]
Date: Wed, 21 Mar 2007 13:26:44 +0000 [thread overview]
Message-ID: <31052.1174483604@redhat.com> (raw)
In-Reply-To: <15256.1174429573@redhat.com>
David Howells <dhowells@redhat.com> wrote:
> > - Why does rxrpc_writable always return 0 ?
>
> Good point. That's slightly tricky to deal with as output messages don't
> remain queued on the socket struct itself. Hmmm...
Okay, I've fixed that by changing it to:
static inline int rxrpc_writable(struct sock *sk)
{
return atomic_read(&sk->sk_wmem_alloc) < (size_t) sk->sk_sndbuf;
}
All the rest of the sk_wmem_alloc management should be automatic through my
use of sock_alloc_send_skb() to allocate Tx buffers.
I notice that AF_UNIX effectively divides sk_sndbuf by four before doing the
comparison. Any idea why (there's no comment to say)? I presume it's so that
we show willingness to accept any chunk of data up to 3/4 of sk_sndbuf in size
if we flag POLLOUT, rather than the app finding POLLOUT is set, but it can
only send one byte of data.
I've still got a problem with this, though, and I'm not sure it's easy to
solve. An RxRPC socket may be performing several calls at once. It may have
sufficient space on the *socket* to accept more Tx data, but it may not be
possible to do so because the ACK window on the intended call may be full. So
POLLOUT could be set, and we might still block anyway:-/
This is unlike SOCK_STREAM sockets for TCP or AF_UNIX, I think, because each
of those has but a single transmit queue:-/
I'm not sure there's a lot I can do about that, but there are a few
possibilities:
(1) Always send data in non-blocking mode if we know there are multiple calls
and we don't want to get stuck. We'll get a suitable error message, but
there's no notification that the Tx queue is has been unblocked. I could
add such a notification (it shouldn't be hard), there are two immediately
obvious ways of doing it:
(a) Raise a one-shot pollable event to indicate that one of the
in-progress calls' Tx queues have come unstuck. This'd require
trying the non-stuck calls individually to find out which one it was.
(b) Queue a message for recvmsg() to grab that says a Tx queue has become
unstuck. This would permit the control message to indicate the call.
(2) Require a separate socket for each individual call. This is a very
heavyweight way of doing things, as it would require socket inodes and
other stuff per call. On the other hand it would permit a certain amount
more flexibility. The real downside is that I wouldn't want to be doing
this for the in-kernel AFS filesystem, but maybe that could bypass the
use of sockets.
(3) Allow the app to nominate which call on a socket it wants a poll() on
that socket to probe next.
David
next prev parent reply other threads:[~2007-03-21 13:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-20 19:58 [PATCH 0/5] [RFC] AF_RXRPC socket family implementation [try #3] David Howells
2007-03-20 19:59 ` [PATCH 1/5] AF_RXRPC: Add blkcipher accessors for using kernel data directly " David Howells
2007-03-20 19:59 ` [PATCH 2/5] AF_RXRPC: Move generic skbuff stuff from XFRM code to generic code " David Howells
2007-03-20 19:59 ` [PATCH 3/5] AF_RXRPC: Make it possible to merely try to cancel timers and delayed work " David Howells
2007-03-20 19:59 ` [PATCH 4/5] AF_RXRPC: Key facility changes for AF_RXRPC " David Howells
2007-03-20 21:12 ` [PATCH 0/5] [RFC] AF_RXRPC socket family implementation " Alan Cox
2007-03-20 22:10 ` David Howells
2007-03-20 21:14 ` Alan Cox
2007-03-20 20:22 ` David Howells
2007-03-20 21:36 ` Alan Cox
2007-03-20 22:26 ` David Howells
2007-03-21 13:26 ` David Howells [this message]
2007-03-21 18:10 ` David Howells
2007-03-21 21:32 ` David Howells
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=31052.1174483604@redhat.com \
--to=dhowells@redhat.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=arjan@infradead.org \
--cc=davem@davemloft.net \
--cc=hch@infradead.org \
--cc=herbert.xu@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).