/* Uses kmalloc if possible. Otherwise falls back to vmalloc.  */
static void ttm_tt_alloc_page_directory(struct ttm_tt *ttm)
/* Uses kmalloc if possible. Otherwise falls back to vmalloc.  */
static void ttm_tt_alloc_page_directory(struct ttm_tt *ttm)
{
	unsigned long size = ttm->num_pages * sizeof(*ttm->pages);
	ttm->pages = NULL;
	if (size <= PAGE_SIZE)
		ttm->pages = kzalloc(size, GFP_KERNEL);
	if (!ttm->pages) {
		ttm->pages = vmalloc_user(size);
		if (ttm->pages)
			ttm->page_flags |= TTM_PAGE_FLAG_VMALLOC;
	}
}