netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: David Miller <davem@davemloft.net>
Cc: jesse.brandeburg@intel.com, cl@linux-foundation.org,
	netdev@vger.kernel.org, mchan@broadcom.com,
	bhutchings@solarflare.com
Subject: Re: about latencies
Date: Fri, 24 Apr 2009 07:11:01 +0200	[thread overview]
Message-ID: <49F149E5.1010304@cosmosbay.com> (raw)
In-Reply-To: <20090423.170408.228280954.davem@davemloft.net>

David Miller a écrit :
> From: Eric Dumazet <dada1@cosmosbay.com>
> Date: Fri, 24 Apr 2009 01:07:06 +0200
> 
>> Brandeburg, Jesse a écrit :
>>> On Thu, 23 Apr 2009, Eric Dumazet wrote:
>>>> We could improve this.
>>>>
>>>> 1) dst_release at xmit time, should save a cache line ping-pong on general case
>>>> 2) sock_wfree() in advance, done at transmit time (generally the thread/cpu doing the send)
>>> how much does the effect socket accounting?  will the app then fill the 
>>> hardware tx ring all the time because there is no application throttling 
>>> due to delayed kfree?
>> tx ring is limited to 256 or 512 or 1024 elements, but yes this might
>> defeat udp mem accounting on sending side, unless using qdiscs...
> 
> I'm pretty sure you really can't do this.  It's been suggested
> countless times in the past.
> 
> The whole point of the socket send buffer limits is to eliminate
> the situation where one socket essentially hogs the TX queue of
> the device.


Yes agreed !

Without splitting sk_sleep and enlarging _again_ "struct sock",
cannot we make sock_def_write_space() smarter ? Avoiding scheduling
as the plague Your Honor :)

Dont we have a bit saying there is a sleeping writer ?

We dirty sk_callback_lock, and read "sk_wmem_alloc" and "sk_sndbuf",
we could first test a flag.



Actual function is : (not a patch, just as reference for convenience)

static void sock_def_write_space(struct sock *sk)
{
        read_lock(&sk->sk_callback_lock);

        /* Do not wake up a writer until he can make "significant"
         * progress.  --DaveM
         */
        if ((atomic_read(&sk->sk_wmem_alloc) << 1) <= sk->sk_sndbuf) {
                if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
                        wake_up_interruptible_sync_poll(sk->sk_sleep, POLLOUT |
                                                POLLWRNORM | POLLWRBAND);

                /* Should agree with poll, otherwise some programs break */
                if (sock_writeable(sk))
                        sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT);
        }

        read_unlock(&sk->sk_callback_lock);
}

Thank you


  reply	other threads:[~2009-04-24  5:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-23 22:02 about latencies Eric Dumazet
2009-04-23 22:06 ` Christoph Lameter
2009-04-23 22:34 ` Brandeburg, Jesse
2009-04-23 23:01   ` Michael Chan
2009-04-23 23:07   ` Eric Dumazet
2009-04-24  0:04     ` David Miller
2009-04-24  5:11       ` Eric Dumazet [this message]
2009-04-24 14:00     ` Christoph Lameter
2009-04-24 14:18       ` 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=49F149E5.1010304@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=bhutchings@solarflare.com \
    --cc=cl@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=jesse.brandeburg@intel.com \
    --cc=mchan@broadcom.com \
    --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).