On 2020-11-24 01:04, Jakub Kicinski wrote:
On Thu, 19 Nov 2020 09:30:15 +0100 Björn Töpel wrote:
+ /* The NAPI context has more processing work, but busy-polling
+ * is preferred. Exit early.
+ */
+ if (napi_prefer_busy_poll(n)) {
+ if (napi_complete_done(n, work)) {
+ /* If timeout is not set, we need to make sure
+ * that the NAPI is re-scheduled.
+ */
+ napi_schedule(n);
+ }
+ goto out_unlock;
+ }
Do we really need to go through napi_complete_done() here?
Isn't it sufficient to check:
if (napi_prefer_busy_poll(n) &&
hrtimer_active(&n->timer)) // not 100% sure this is the
// right helper for the check
If timer is scheduled it will fire and worst case sirq will kick back
in after timeout. napi_complete_done() should had been called by the
driver already to schedule the timer. If the driver doesn't call
napi_complete_done() we should not allow it to use busy_poll() anyway.
No, it's not. For a heavy traffic load, the napi_complete_done() will
never be called by the driver. It'll just keep on spinning in the
ksoftirqd. This code is to force out of that loop, so we need to call
napi_complete_done() explicitly (which will set the timeout).
Without the explicit napi_complete_done(), the ksoftirqd will not stop,
and the busy-polling will never allow to enter.
Björn