On Wed, 25 Mar 2026 11:41:05 -0700
Rob Clark <[email protected]> wrote:

> The intention here was to allow blocking if DIRECT_RECLAIM or if called
> from kswapd and KSWAPD_RECLAIM is set.
> 
> Reported by Claude code review: 
> https://lore.gitlab.freedesktop.org/drm-ai-reviews/review-patch9-20260309151119.290217-10-boris.brezil...@collabora.com/
>  on a panthor patch which had copied similar logic.
> 
> Reported-by: Boris Brezillon <[email protected]>
> Fixes: 7860d720a84c ("drm/msm: Fix build break with recent mm tree")
> Signed-off-by: Rob Clark <[email protected]>

Reviewed-by: Boris Brezillon <[email protected]>

> ---
>  drivers/gpu/drm/msm/msm_gem_shrinker.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/msm_gem_shrinker.c 
> b/drivers/gpu/drm/msm/msm_gem_shrinker.c
> index 1039e3c0a47b..31fa51a44f86 100644
> --- a/drivers/gpu/drm/msm/msm_gem_shrinker.c
> +++ b/drivers/gpu/drm/msm/msm_gem_shrinker.c
> @@ -26,9 +26,8 @@ static bool can_swap(void)
>  
>  static bool can_block(struct shrink_control *sc)
>  {
> -     if (!(sc->gfp_mask & __GFP_DIRECT_RECLAIM))
> -             return false;
> -     return current_is_kswapd() || (sc->gfp_mask & __GFP_RECLAIM);
> +     return (sc->gfp_mask & __GFP_DIRECT_RECLAIM) ||
> +            (current_is_kswapd() && (sc->gfp_mask & __GFP_KSWAPD_RECLAIM));
>  }
>  
>  static unsigned long

Reply via email to