From: Roland Dreier <rdreier@cisco.com>
To: hadi@cyberus.ca
Cc: Shirley Ma <xma@us.ibm.com>, David Miller <davem@davemloft.net>,
jgarzik@pobox.com, netdev@vger.kernel.org,
netdev-owner@vger.kernel.org, rusty@rustcorp.com.au,
shemminger@linux-foundation.org
Subject: Re: [PATCH RFC]: napi_struct V5
Date: Thu, 09 Aug 2007 09:58:58 -0700 [thread overview]
Message-ID: <adamyx0od9p.fsf@cisco.com> (raw)
In-Reply-To: <1186587154.5155.43.camel@localhost> (jamal's message of "Wed, 08 Aug 2007 11:32:34 -0400")
> > Dave, could you please hold this portion of the patch for a moment. I
> > will test this patch ASAP. According to our previous experience, this
> > changes significant changes some IPoIB driver performance.
> If you adjust your quantum while doing that testing you may find an
> optimal value.
> Think of a box where you have other network interfaces, the way you
> are implementing currently implies you are going to be very unfair to
> the other interfaces on the box.
Could you explain why this is unfair? This is an honest question: I'm
not trying to be difficult, I just don't see how this implementation
leads to unfairness. If a driver uses *less* than its full budget in
the poll routine, requests that the poll routine be rescheduled and
then returns, it seems to me that the effect on other interfaces would
be to give them more than their fair share of NAPI processing time.
Also, perhaps it would be a good idea to explain exactly what the
ipoib driver is doing in its NAPI poll routine. The difficultly is
that the IB "interrupt" semantics are not a perfect fit for NAPI -- in
effect, IB just gives us an edge-triggered one-shot interrupt, and so
there is an unadvoidable race between detecting that there is no more
work to do and enabling the interrupt. It's not worth going into the
details of why things are this way, but IB can return a hint that says
"you may have missed an event" when enabling the interrupt, which can
be used to close the race. So the two implementations being discussed
are roughly:
if (may_have_missed_event &&
netif_rx_reschedule(napi))
goto poll_more;
versus
if (may_have_missed_event) {
netif_rx_reschedule(napi))
return done;
}
The second one seems to perform better because in the missed event
case, it gives a few more packets a chance to arrive so that we can
amortize the polling overhead a little more. To be honest, I've never
been able to come up with a good story of why the IBM hardware where
this makes a measurable difference hits the missed event case enough
for it to matter.
The other thing that confuses me about why this is a fairness issue is
that if this were a driver where the missed event race didn't happen,
when we detected no more work to do, we would just do:
netif_rx_complete(napi);
enable_hw_interrupts();
return done;
and if a packet arrived between netif_rx_complete and enabling
interrupts, we would still get an interrupt and so the effect would be
to reschedule polling, just via a more inefficient route (going
through the HW interrupt handler).
So clarification on this point would be appreciated -- not because I
want to continue an argument, but just to improve my understanding of NAPI.
- Roland
next prev parent reply other threads:[~2007-08-09 16:59 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-06 6:24 [PATCH RFC]: napi_struct V5 David Miller
2007-08-06 18:00 ` Michael Chan
2007-08-06 20:50 ` David Miller
2007-08-07 12:52 ` jamal
2007-08-08 0:59 ` David Miller
2007-08-08 12:10 ` jamal
2007-08-09 4:35 ` David Miller
2007-08-07 22:37 ` Roland Dreier
2007-08-07 23:06 ` David Miller
2007-08-08 3:56 ` Roland Dreier
2007-08-08 4:08 ` David Miller
[not found] ` <OFA2F18805.38AA0BD0-ON87257331.005367FB-88257331.0027BEED@us.ibm.com>
2007-08-08 15:32 ` jamal
2007-08-09 4:23 ` David Miller
2007-08-09 5:32 ` Jeff Garzik
2007-08-09 16:58 ` Roland Dreier [this message]
2007-08-10 13:55 ` jamal
2007-08-10 21:39 ` David Miller
2007-08-13 21:47 ` Roland Dreier
2007-08-08 22:20 ` David Miller
2007-08-08 23:23 ` Shirley Ma
2007-08-09 17:49 ` Roland Dreier
2007-08-09 18:16 ` Shirley Ma
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=adamyx0od9p.fsf@cisco.com \
--to=rdreier@cisco.com \
--cc=davem@davemloft.net \
--cc=hadi@cyberus.ca \
--cc=jgarzik@pobox.com \
--cc=netdev-owner@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=shemminger@linux-foundation.org \
--cc=xma@us.ibm.com \
/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).