netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Patrick McHardy <kaber@trash.net>
Cc: netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [PATCH] netlink: add NETLINK_NO_ENOBUFS socket flag
Date: Mon, 23 Mar 2009 13:11:53 +0100	[thread overview]
Message-ID: <49C77C89.1010108@netfilter.org> (raw)
In-Reply-To: <49C77971.8080302@trash.net>

Patrick McHardy wrote:
> Pablo Neira Ayuso wrote:
>> This patch adds the NETLINK_NO_ENOBUFS socket flag. This flag can
>> be used by unicast and broadcast listeners to avoid receiving
>> ENOBUFS errors.
>>
>> Generally speaking, ENOBUFS errors are useful to notify two things
>> to the listener:
>>
>> a) You may increase the receiver buffer size via setsockopt().
>> b) You have lost messages, you may be out of sync.
>>
>> In some cases, ignoring ENOBUFS errors can be useful. For example:
>>
>> a) nfnetlink_queue: this subsystem does not have any sort of resync
>> method and you can decide to ignore ENOBUFS once you have set a
>> given buffer size.
>>
>> b) ctnetlink: you can use this together with the socket flag
>> NETLINK_BROADCAST_SEND_ERROR to stop getting ENOBUFS errors as
>> you do not need to resync (packets whose event are not delivered
>> are drop to provide reliable logging and state-synchronization).
>>
>> Moreover, the use of NETLINK_NO_ENOBUFS also reduces a "go up, go down"
>> effect in terms of performance which is due to the netlink congestion
>> control when the listener cannot back off. The effect is the following:
>>
>> 1) throughput rate goes up and netlink messages are inserted in the
>> receiver buffer.
>> 2) Then, netlink buffer fills and overruns (set on nlk->state bit 0).
>> 3) While the listener empties the receiver buffer, netlink keeps
>> dropping messages. Thus, throughput goes dramatically down.
>> 4) Then, once the listener has emptied the buffer (nlk->state
>> bit 0 is set off), goto step 1.
> 
> I agree that not having netlink drop new messages after congestion
> might be useful. Two suggestions though:
> 
> - NETLINK_NO_CONGESTION_CONTROL seems a bit more descriptive than
>   "NO_ENOBUFS"
> 
> - The ENOBUFS error itself is actually not the problem, but the
>   congestion handling. It still makes sense to notify userspace
>   of congestion. I'd suggest to deliver the error, but avoid setting
>   the congestion bit.

I thought about this choice but I see one problem with this. The ENOBUFS
error is attached to the congestion control. If we keep reporting
ENOBUFS errors to userspace with no congestion control, the listener may
keep receiving ENOBUFS indefinitely. In other words, the congestion
control seems to me like a way to avoid spamming ENOBUFS errors to
userspace.

-- 
"Los honestos son inadaptados sociales" -- Les Luthiers

  reply	other threads:[~2009-03-23 12:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-23  9:33 [PATCH] netlink: add NETLINK_NO_ENOBUFS socket flag Pablo Neira Ayuso
2009-03-23 11:58 ` Patrick McHardy
2009-03-23 12:11   ` Pablo Neira Ayuso [this message]
2009-03-23 12:14     ` Patrick McHardy
2009-03-23 12:25       ` Pablo Neira Ayuso
2009-03-23 12:41         ` Patrick McHardy
2009-03-23 13:05           ` Pablo Neira Ayuso
2009-03-23 13:09             ` Patrick McHardy
  -- strict thread matches above, loose matches on Subject: below --
2009-03-23 14:18 Pablo Neira Ayuso
2009-03-24 23:38 ` David Miller

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=49C77C89.1010108@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=kaber@trash.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;
as well as URLs for NNTP newsgroup(s).