Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [High] The Panfrost GEM shrinker is silently skipped and left uninitialized 
if transparent hugepages (THP) are disabled.
--

--- Patch [4]: [PATCH v3 04/13] drm/panfrost: Move shrinker initialization and 
unplug one level down ---
commit ba73347cedd0ca5a2e99301107bfd0b9268d44b4
Author: Adrián Larumbe <[email protected]>

drm/panfrost: Move shrinker initialization and unplug one level down

This commit moves the panfrost shrinker initialization into
panfrost_gem_init() so it is ready before drm_dev_register() completes.
It also updates the shrinker functions to take a panfrost_device pointer.

[ ... ]

> diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c 
> b/drivers/gpu/drm/panfrost/panfrost_gem.c
> index 3a7fce4288987..d2cd357a2ae33 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_gem.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_gem.c
> @@ -15,13 +15,13 @@
>  #include "panfrost_gem.h"
>  #include "panfrost_mmu.h"
>  
> -void panfrost_gem_init(struct panfrost_device *pfdev)
> +int panfrost_gem_init(struct panfrost_device *pfdev)
>  {
>       int err;
>  
>       if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) &&
>           !panfrost_transparent_hugepage)
> -             return;
> +             return 0;

[Severity: High]
Will this early return bypass the newly added shrinker initialization at the
end of the function?

If the kernel is compiled with CONFIG_TRANSPARENT_HUGEPAGE and the module
parameter panfrost.transparent_hugepage is set to false, panfrost_gem_init() 
returns early here. This leaves the GEM shrinker completely uninitialized, 
which could lead to out-of-memory conditions under memory pressure because
memory reclaim capabilities for GEM objects are lost.

>  
>       err = drm_gem_huge_mnt_create(&pfdev->base, "within_size");
>       if (drm_gem_get_huge_mnt(&pfdev->base))
> @@ -29,6 +29,8 @@ void panfrost_gem_init(struct panfrost_device *pfdev)
>       else if (err)
>               drm_warn(&pfdev->base, "Can't use Transparent Hugepage (%d)\n",
>                        err);
> +
> +     return panfrost_gem_shrinker_init(pfdev);
>  }

[ ... ]

-- 
Sashiko AI review · 
https://sashiko.dev/#/patchset/[email protected]?part=4

Reply via email to