public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* yield() in netlink_broadcast_filtered
@ 2012-04-06 14:11 Fredrick
  2012-04-06 15:05 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Fredrick @ 2012-04-06 14:11 UTC (permalink / raw)
  To: netdev; +Cc: eric.dumazet



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?


-Fredrick

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: yield() in netlink_broadcast_filtered
  2012-04-06 14:11 yield() in netlink_broadcast_filtered Fredrick
@ 2012-04-06 15:05 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2012-04-06 15:05 UTC (permalink / raw)
  To: Fredrick; +Cc: netdev, eric.dumazet

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-06 15:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-06 14:11 yield() in netlink_broadcast_filtered Fredrick
2012-04-06 15:05 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox