summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/mlx5/mr.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-12-23 08:33:34 +0100
committerTakashi Iwai <tiwai@suse.de>2015-12-23 08:33:34 +0100
commit59c8231089be96165735585694a801ae58ec6c95 (patch)
tree41bd60a9aec5df20e07a81fbb526c8bc05e997fc /drivers/infiniband/hw/mlx5/mr.c
parentde5126cc3c0b0f291d08fa591dcdf237bc595a56 (diff)
parent0fb0b822d157325b66c503d23332f64899bfb828 (diff)
Merge branch 'for-linus' into for-next
Conflicts: drivers/gpu/drm/i915/intel_pm.c
Diffstat (limited to 'drivers/infiniband/hw/mlx5/mr.c')
-rw-r--r--drivers/infiniband/hw/mlx5/mr.c14
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)
}
}
} else if (ent->cur > 2 * ent->limit) {
- if (!someone_adding(cache) &&
+ /*
+ * The remove_keys() logic is performed as garbage collection
+ * task. Such task is intended to be run when no other active
+ * processes are running.
+ *
+ * The need_resched() will return TRUE if there are user tasks
+ * to be activated in near future.
+ *
+ * In such case, we don't execute remove_keys() and postpone
+ * the garbage collection work to try to run in next cycle,
+ * in order to free CPU resources to other tasks.
+ */
+ if (!need_resched() && !someone_adding(cache) &&
time_after(jiffies, cache->last_add + 300 * HZ)) {
remove_keys(dev, i, 1);
if (ent->cur > ent->limit)