[PATCH 5/8] drm/ttm: convert page allocation to use page ptr array instead of list V2

Konrad Rzeszutek Wilk konrad.wilk at oracle.com
Thu Nov 3 11:45:11 PDT 2011


On Wed, Nov 02, 2011 at 07:37:52PM -0400, j.glisse at gmail.com wrote:
> From: Jerome Glisse <jglisse at redhat.com>
> 
> Use the ttm_tt page ptr array for page allocation, move the list to
> array unwinding into the page allocation functions.
> 
> V2 split the fix to use ttm put page as a separate fix
> properly fill pages array when TTM_PAGE_FLAG_ZERO_ALLOC is not
> set
> 
> Signed-off-by: Jerome Glisse <jglisse at redhat.com>

.. snip..
>  static void ttm_tt_free_alloced_pages(struct ttm_tt *ttm)
>  {
> -	int i;
> -	unsigned count = 0;
> -	struct list_head h;
> -	struct page *cur_page;
>  	struct ttm_backend *be = ttm->be;
> -
> -	INIT_LIST_HEAD(&h);
> +	struct ttm_mem_global *glob = ttm->glob->mem_glob;
>  
>  	if (be)
>  		be->func->clear(be);
> -	for (i = 0; i < ttm->num_pages; ++i) {
>  
> -		cur_page = ttm->pages[i];
> -		ttm->pages[i] = NULL;
> -		if (cur_page) {
> -			if (page_count(cur_page) != 1)

We don't want to keep that check? Or perhaps move that
functionality into ttm_put_pages?


> -				printk(KERN_ERR TTM_PFX
> -				       "Erroneous page count. "
> -				       "Leaking pages.\n");
> -			ttm_mem_global_free_page(ttm->glob->mem_glob,
> -						 cur_page);
> -			list_add(&cur_page->lru, &h);
> -			count++;
> -		}
> -	}
> -	ttm_put_pages(&h, count, ttm->page_flags, ttm->caching_state,
> -		      ttm->dma_address);
> +	ttm_mem_global_free_pages(glob, ttm->pages, ttm->num_pages);
> +	ttm_put_pages(ttm->pages, ttm->num_pages, ttm->page_flags,
> +			ttm->caching_state, ttm->dma_address);
>  	ttm->state = tt_unpopulated;
>  }

Otherwise Reviewd-by...


More information about the dri-devel mailing list