kfree_rcu(node, rcu);
}
-static bool
-pool_free_older_than(struct intel_gt_buffer_pool *pool, unsigned long old)
+static bool pool_free_older_than(struct intel_gt_buffer_pool *pool, long keep)
{
struct intel_gt_buffer_pool_node *node, *stale = NULL;
bool active = false;
/* Most recent at head; oldest at tail */
list_for_each_prev(pos, list) {
+ unsigned long age;
+
node = list_entry(pos, typeof(*node), link);
- if (time_before(node->age, old))
+
+ age = READ_ONCE(node->age);
+ if (!age || jiffies - age < keep)
break;
/* Check we are the first to claim this node */
struct intel_gt_buffer_pool *pool =
container_of(wrk, typeof(*pool), work.work);
- if (pool_free_older_than(pool, jiffies - HZ))
+ if (pool_free_older_than(pool, HZ))
schedule_delayed_work(&pool->work,
round_jiffies_up_relative(HZ));
}
struct intel_gt_buffer_pool *pool = >->buffer_pool;
do {
- while (pool_free_older_than(pool, jiffies + 1))
+ while (pool_free_older_than(pool, 0))
;
} while (cancel_delayed_work_sync(&pool->work));
}