Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

r8169: improve handling task scheduling

If we know that the task is going to be a no-op, don't even schedule it.
And remove the check for netif_running() in the worker function, the
check for flag RTL_FLAG_TASK_ENABLED is sufficient. Note that we can't
remove the check for flag RTL_FLAG_TASK_ENABLED in the worker function
because we have no guarantee when it will be executed.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Link: https://lore.kernel.org/r/c65873a3-7394-4107-99a7-83f20030779c@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Heiner Kallweit and committed by
Jakub Kicinski
127532cd ee754639

+4 -2
+4 -2
drivers/net/ethernet/realtek/r8169_main.c
··· 2227 2227 2228 2228 static void rtl_schedule_task(struct rtl8169_private *tp, enum rtl_flag flag) 2229 2229 { 2230 + if (!test_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags)) 2231 + return; 2232 + 2230 2233 set_bit(flag, tp->wk.flags); 2231 2234 schedule_work(&tp->wk.work); 2232 2235 } ··· 4470 4467 4471 4468 rtnl_lock(); 4472 4469 4473 - if (!netif_running(tp->dev) || 4474 - !test_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags)) 4470 + if (!test_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags)) 4475 4471 goto out_unlock; 4476 4472 4477 4473 if (test_and_clear_bit(RTL_FLAG_TASK_TX_TIMEOUT, tp->wk.flags)) {