FreeBSD/sys/dev/drm2/ttm/ttm_page_alloc.c
/**
 * Callback for mm to request pool to reduce number of page held.
 */
Callback for mm to request pool to reduce number of page held.
Callback for mm to request pool to reduce number of page held .
static int ttm_pool_mm_shrink(void *arg)
{
	static unsigned int start_pool = 0;
	unsigned i;
	unsigned pool_offset = atomic_fetchadd_int(&start_pool, 1);
	struct ttm_page_pool *pool;
	int shrink_pages = 100; 
	pool_offset = pool_offset % NUM_POOLS;
	for (i = 0; i < NUM_POOLS; ++i) {
		unsigned nr_free = shrink_pages;
		if (shrink_pages == 0)
			break;
		pool = &_manager->pools[(i + pool_offset)%NUM_POOLS];
		shrink_pages = ttm_page_pool_free(pool, nr_free);
	}
	return ttm_pool_get_num_unused_pages();
}
static int ttm_pool_mm_shrink ( void * arg ) { static unsigned int start_pool = 0 ; unsigned i ; unsigned pool_offset = atomic_fetchadd_int ( & start_pool , 1 ) ; struct ttm_page_pool * pool ; int shrink_pages = 100 ; pool_offset = pool_offset % NUM_POOLS ; for ( i = 0 ; i < NUM_POOLS ; ++ i ) { unsigned nr_free = shrink_pages ; if ( shrink_pages == 0 ) break ; pool = & _manager -> pools [ ( i + pool_offset ) % NUM_POOLS ] ; shrink_pages = ttm_page_pool_free ( pool , nr_free ) ; } return ttm_pool_get_num_unused_pages ( ) ; }
Callback for mm to request pool to reduce number of page held.
Callback for mm to request pool to reduce number of page held .
/* XXXKIB */ /* select start pool in round robin fashion */ /* return estimated number of unused pages in pool */