/* At this point we only support a single shrink callback. Extend this if needed, perhaps using a linked list of callbacks. Note that this function is reentrant: many threads may try to swap out at any given time.  */
static void ttm_shrink(struct ttm_mem_global *glob, bool from_wq, uint64_t extra)
/* At this point we only support a single shrink callback. Extend this if needed, perhaps using a linked list of callbacks. Note that this function is reentrant: many threads may try to swap out at any given time.  */
static void ttm_shrink(struct ttm_mem_global *glob, bool from_wq, uint64_t extra)
{
	int ret;
	struct ttm_mem_shrink *shrink;
	spin_lock(&glob->lock);
	if (glob->shrink == NULL)
		goto out;
	while (ttm_zones_above_swap_target(glob, from_wq, extra)) {
		shrink = glob->shrink;
		spin_unlock(&glob->lock);
		ret = shrink->do_shrink(shrink);
		spin_lock(&glob->lock);
		if (unlikely(ret != 0))
			goto out;
	}
out:
	spin_unlock(&glob->lock);
}