/* * Compute a power-of-two bucket, but throw everything greater than * 16KiB into the same bucket: i.e. the buckets hold objects of * (1 page, 2 pages, 4 pages, 8+ pages).
*/
n = fls(sz >> PAGE_SHIFT) - 1; if (n >= ARRAY_SIZE(pool->cache_list))
n = ARRAY_SIZE(pool->cache_list) - 1;
staticbool pool_free_older_than(struct intel_gt_buffer_pool *pool, long keep)
{ struct intel_gt_buffer_pool_node *node, *stale = NULL; bool active = false; int n;
/* Free buffers that have not been used in the past second */ for (n = 0; n < ARRAY_SIZE(pool->cache_list); n++) { struct list_head *list = &pool->cache_list[n];
if (list_empty(list)) continue;
if (spin_trylock_irq(&pool->lock)) { struct list_head *pos;
/* Most recent at head; oldest at tail */
list_for_each_prev(pos, list) { unsignedlong age;
node = list_entry(pos, typeof(*node), link);
age = READ_ONCE(node->age); if (!age || jiffies - age < keep) break;
/* Check we are the first to claim this node */ if (!xchg(&node->age, 0)) break;
node->free = stale;
stale = node;
} if (!list_is_last(pos, list))
__list_del_many(pos, list);
spin_unlock_irq(&pool->lock);
}
active |= !list_empty(list);
}
while ((node = stale)) {
stale = stale->free;
node_free(node);
}
__i915_gem_object_pin_pages(node->obj); /* Hide this pinned object from the shrinker until retired */
i915_gem_object_make_unshrinkable(node->obj);
node->pinned = true;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.