From: Stephen Hemminger <shemminger@vyatta.com>
To: Fredrick <fjohnber@zoho.com>
Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com
Subject: Re: yield() in netlink_broadcast_filtered
Date: Fri, 6 Apr 2012 08:05:34 -0700 [thread overview]
Message-ID: <20120406080534.33e0d1c4@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <4F7EF9AC.8050305@zoho.com>
On Fri, 06 Apr 2012 07:11:56 -0700
Fredrick <fjohnber@zoho.com> wrote:
>
>
> I see there is a yield being called from
> netlink_broadcast_filtered.
> .....
> int netlink_broadcast_filtered(...)
> {
> ....
> if (info.delivered) {
> if (info.congested && (allocation & __GFP_WAIT))
> yield();
> return 0;
> }
> return -ESRCH;
> }
> .....
>
> But I don't see the point of calling it.
> After the yield, there is nothing being done.
> It just returns. So why yield ?
> Why can't it simply return?
>
Because without that yield it is easily possible for one process
to generate lots of netlink messages and overrun the consumers.
The yield allows the now ready listening processes to run.
There is no good mechanism to totally prevent overrunning the
socket of processes reading for netlink events, but this yield()
is good enough to avoid the problem with the typical case.
The example we are familar with is a full route table (1M routes)
and a link change causing a routing flap.
prev parent reply other threads:[~2012-04-06 15:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-06 14:11 yield() in netlink_broadcast_filtered Fredrick
2012-04-06 15:05 ` Stephen Hemminger [this message]
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=20120406080534.33e0d1c4@nehalam.linuxnetplumber.net \
--to=shemminger@vyatta.com \
--cc=eric.dumazet@gmail.com \
--cc=fjohnber@zoho.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