diff options
Diffstat (limited to 'drivers/infiniband/hw/mlx5/mr.c')
-rw-r--r-- | drivers/infiniband/hw/mlx5/mr.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index ec8993a7b3be..6000f7aeede9 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c | |||
@@ -381,7 +381,19 @@ static void __cache_work_func(struct mlx5_cache_ent *ent) | |||
381 | } | 381 | } |
382 | } | 382 | } |
383 | } else if (ent->cur > 2 * ent->limit) { | 383 | } else if (ent->cur > 2 * ent->limit) { |
384 | if (!someone_adding(cache) && | 384 | /* |
385 | * The remove_keys() logic is performed as garbage collection | ||
386 | * task. Such task is intended to be run when no other active | ||
387 | * processes are running. | ||
388 | * | ||
389 | * The need_resched() will return TRUE if there are user tasks | ||
390 | * to be activated in near future. | ||
391 | * | ||
392 | * In such case, we don't execute remove_keys() and postpone | ||
393 | * the garbage collection work to try to run in next cycle, | ||
394 | * in order to free CPU resources to other tasks. | ||
395 | */ | ||
396 | if (!need_resched() && !someone_adding(cache) && | ||
385 | time_after(jiffies, cache->last_add + 300 * HZ)) { | 397 | time_after(jiffies, cache->last_add + 300 * HZ)) { |
386 | remove_keys(dev, i, 1); | 398 | remove_keys(dev, i, 1); |
387 | if (ent->cur > ent->limit) | 399 | if (ent->cur > ent->limit) |