[PATCH] drm/ttm: use compound pages for THP

Christian König christian.koenig at amd.com
Wed Jan 13 08:58:49 UTC 2021


Am 13.01.21 um 09:47 schrieb David Stevens:
> Compound page metadata is necessary for page reference counting to work
> properly on pages besides the head page. Without it, put_page
> corresponding to the last outstanding get_page call on a tail page will
> end up freeing that page, even if the bo still references the page.

NAK, I should add a comment since I can't count any more how many times 
people came up with this.

Calling put_page() on a TTM allocated page is strictly illegal in the 
first place since they are not reference counted.

Please don't tell me somebody once more tried to mmap() pages from a 
DMA-buf created sg_table into a process address space?

Regards,
Christian.

>
> Signed-off-by: David Stevens <stevensd at chromium.org>
> ---
>   drivers/gpu/drm/ttm/ttm_pool.c | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c
> index 7b2f60616750..09239b93dc2c 100644
> --- a/drivers/gpu/drm/ttm/ttm_pool.c
> +++ b/drivers/gpu/drm/ttm/ttm_pool.c
> @@ -83,7 +83,6 @@ static struct page *ttm_pool_alloc_page(struct ttm_pool *pool, gfp_t gfp_flags,
>   		gfp_flags |= GFP_TRANSHUGE_LIGHT | __GFP_NORETRY |
>   			__GFP_KSWAPD_RECLAIM;
>   		gfp_flags &= ~__GFP_MOVABLE;
> -		gfp_flags &= ~__GFP_COMP;
>   	}
>   
>   	if (!pool->use_dma_alloc) {



More information about the dri-devel mailing list