[PATCH v4 7/8] drm/v3d: Use gemfs/THP in BO creation if available

Iago Toral itoral at igalia.com
Mon Apr 29 05:22:33 UTC 2024


Hi Maíra, 

a question below:

El dom, 28-04-2024 a las 09:40 -0300, Maíra Canal escribió:
> Although Big/Super Pages could appear naturally, it would be quite
> hard
> to have 1MB or 64KB allocated contiguously naturally. Therefore, we
> can
> force the creation of large pages allocated contiguously by using a
> mountpoint with "huge=within_size" enabled.
> 
> Therefore, as V3D has a mountpoint with "huge=within_size" (if user
> has
> THP enabled), use this mountpoint for BO creation if available. This
> will allow us to create large pages allocated contiguously and make
> use
> of Big/Super Pages.
> 
> Signed-off-by: Maíra Canal <mcanal at igalia.com>
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
> ---
> 

(...)

> @@ -130,10 +140,17 @@ struct v3d_bo *v3d_bo_create(struct drm_device
> *dev, struct drm_file *file_priv,
>  			     size_t unaligned_size)
>  {
>  	struct drm_gem_shmem_object *shmem_obj;
> +	struct v3d_dev *v3d = to_v3d_dev(dev);
>  	struct v3d_bo *bo;
>  	int ret;
>  
> -	shmem_obj = drm_gem_shmem_create(dev, unaligned_size);
> +	/* Let the user opt out of allocating the BOs with THP */
> +	if (v3d->gemfs)
> +		shmem_obj = drm_gem_shmem_create_with_mnt(dev,
> unaligned_size,
> +							  v3d-
> >gemfs);
> +	else
> +		shmem_obj = drm_gem_shmem_create(dev,
> unaligned_size);
> +
>  	if (IS_ERR(shmem_obj))
>  		return ERR_CAST(shmem_obj);
>  	bo = to_v3d_bo(&shmem_obj->base);


if I read this correctly when we have THP we always allocate with that,
Even objects that are smaller than 64KB. I was wondering if there is
any benefit/downside to this or if the behavior for small allocations
is the same we had without the new mount point.

Iago


More information about the dri-devel mailing list