On Sat,  4 Oct 2025 11:30:48 +0200
Loïc Molinari <[email protected]> wrote:

> +static void
> +v3d_huge_mnt_init(struct v3d_dev *v3d)
> +{
> +     int err;
> +
> +     /*
> +      * By creating our own shmemfs mountpoint, we can pass in
> +      * mount flags that better match our usecase. However, we
> +      * only do so on platforms which benefit from it.
> +      */
> +     if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
> +             goto err;
> +
> +     /* The user doesn't want to enable Super Pages */
> +     if (!super_pages)
> +             goto err;
> +
> +     err = drm_gem_huge_mnt_create(&v3d->drm, "within_size");
> +     if (err && err != -EEXIST)
> +             goto err;
> +
> +     drm_info(&v3d->drm, "Using Transparent Hugepages\n");
> +
> +     return;
> +
> +err:
> +     drm_notice(&v3d->drm,
> +                "Transparent Hugepage support is recommended for optimal 
> performance on this platform!\n");

With the changes suggested on patch 3, this can be shrunk a little bit:

        int err = 0;

        if (super_pages)
                err = drm_gem_huge_mnt_create(&v3d->drm, "within_size");

        if (v3d->drm.huge_mnt)
                drm_info(&v3d->drm, "Using Transparent Hugepages\n");
        else if (!err)
                drm_notice(&v3d->drm,
                           "Transparent Hugepage support is recommended for 
optimal performance on this platform!\n");
        else
                drm_warn(&v3d->drm, "Couldn't create THP mount point 
(err=%d)\n", err);

Reply via email to