FreeBSD/sys/dev/drm2/ttm/ttm_memory.c
/**
 * 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.
 */
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.
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;
	mtx_lock(&glob->lock);
	if (glob->shrink == NULL)
		goto out;
	while (ttm_zones_above_swap_target(glob, from_wq, extra)) {
		shrink = glob->shrink;
		mtx_unlock(&glob->lock);
		ret = shrink->do_shrink(shrink);
		mtx_lock(&glob->lock);
		if (unlikely(ret != 0))
			goto out;
	}
out:
	mtx_unlock(&glob->lock);
}
static void ttm_shrink ( struct ttm_mem_global * glob , bool from_wq , uint64_t extra ) { int ret ; struct ttm_mem_shrink * shrink ; mtx_lock ( & glob -> lock ) ; if ( glob -> shrink == NULL ) goto out ; while ( ttm_zones_above_swap_target ( glob , from_wq , extra ) ) { shrink = glob -> shrink ; mtx_unlock ( & glob -> lock ) ; ret = shrink -> do_shrink ( shrink ) ; mtx_lock ( & glob -> lock ) ; if ( unlikely ( ret != 0 ) ) goto out ; } out : mtx_unlock ( & glob -> lock ) ; }
At this point we only support a single shrink callback.
At this point we only support a single shrink callback .