Skip to content

Commit

Permalink
r8169: improve handling task scheduling
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Heiner Kallweit authored and Jakub Kicinski committed Nov 30, 2023
1 parent ee75463 commit 127532c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/net/ethernet/realtek/r8169_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2227,6 +2227,9 @@ u16 rtl8168h_2_get_adc_bias_ioffset(struct rtl8169_private *tp)

static void rtl_schedule_task(struct rtl8169_private *tp, enum rtl_flag flag)
{
if (!test_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags))
return;

set_bit(flag, tp->wk.flags);
schedule_work(&tp->wk.work);
}
Expand Down Expand Up @@ -4467,8 +4470,7 @@ static void rtl_task(struct work_struct *work)

rtnl_lock();

if (!netif_running(tp->dev) ||
!test_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags))
if (!test_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags))
goto out_unlock;

if (test_and_clear_bit(RTL_FLAG_TASK_TX_TIMEOUT, tp->wk.flags)) {
Expand Down

0 comments on commit 127532c

Please sign in to comment.