diff options
author | Edward Cree <ecree@solarflare.com> | 2020-02-17 13:43:10 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-02-17 14:35:23 -0800 |
commit | b7683155517c09c7e0f9d791eaab6dab3b4b2477 (patch) | |
tree | cea3ca29b8db6619ce2b9f90695c919f0f3d1fd1 /drivers/net/ethernet/sfc/efx.h | |
parent | bd706ff8ea2b6e2d3f21f0863b2fc42f860f8ba2 (diff) | |
download | lwn-b7683155517c09c7e0f9d791eaab6dab3b4b2477.tar.gz lwn-b7683155517c09c7e0f9d791eaab6dab3b4b2477.zip |
sfc: only schedule asynchronous filter work if needed
Prevent excessive CPU time spent running a workitem with nothing to do.
We avoid any races by keeping the same check in efx_filter_rfs_expire().
Suggested-by: Martin Habets <mhabets@solarflare.com>
Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sfc/efx.h')
-rw-r--r-- | drivers/net/ethernet/sfc/efx.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/sfc/efx.h b/drivers/net/ethernet/sfc/efx.h index f1bdb04efbe4..78babbe6d2d8 100644 --- a/drivers/net/ethernet/sfc/efx.h +++ b/drivers/net/ethernet/sfc/efx.h @@ -159,7 +159,7 @@ static inline void efx_filter_rfs_expire(struct work_struct *data) channel = container_of(dwork, struct efx_channel, filter_work); time = jiffies - channel->rfs_last_expiry; quota = channel->rfs_filter_count * time / (30 * HZ); - if (quota > 20 && __efx_filter_rfs_expire(channel, min(channel->rfs_filter_count, quota))) + if (quota >= 20 && __efx_filter_rfs_expire(channel, min(channel->rfs_filter_count, quota))) channel->rfs_last_expiry += time; /* Ensure we do more work eventually even if NAPI poll is not happening */ schedule_delayed_work(dwork, 30 * HZ); |