Re: [PATCH v2 2/2] drm/msm/gem: Add modparam to disable shrinker blocking
From: Konrad Dybcio
Date: Mon Sep 14 2026 - 04:02:19 EST
On 9/12/26 4:59 PM, Rob Clark wrote:
> Normally if we are under enough memory pressure, the shrinker will
> eventually start waiting for BOs to become idle. In some very latency
> sensitive use-cases this is undesirable.
>
> Signed-off-by: Rob Clark <robin.clark@xxxxxxxxxxxxxxxx>
> ---
> drivers/gpu/drm/msm/msm_gem_shrinker.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/msm_gem_shrinker.c b/drivers/gpu/drm/msm/msm_gem_shrinker.c
> index 3514d5c84989..83ee032cb21d 100644
> --- a/drivers/gpu/drm/msm/msm_gem_shrinker.c
> +++ b/drivers/gpu/drm/msm/msm_gem_shrinker.c
> @@ -19,6 +19,10 @@ static bool enable_eviction = true;
> MODULE_PARM_DESC(enable_eviction, "Enable swappable GEM buffers");
> module_param(enable_eviction, bool, 0600);
>
> +static bool eviction_can_block = true;
> +MODULE_PARM_DESC(eviction_can_block, "Enable blocking for GEM buffer to become idle for eviction");
> +module_param(eviction_can_block, bool, 0600);
> +
> static bool can_swap(void)
> {
> return enable_eviction && get_nr_swap_pages() > 0;
> @@ -26,6 +30,8 @@ static bool can_swap(void)
>
> static bool can_block(struct shrink_control *sc)
> {
> + if (!eviction_can_block)
> + return false;
> return (sc->gfp_mask & __GFP_DIRECT_RECLAIM) ||
> (current_is_kswapd() && (sc->gfp_mask & __GFP_KSWAPD_RECLAIM));
> }
This is just a guess, but can we always keep both and jump out
of msm_gem_shrinker_scan() early if we can satistfy nr_to_scan
without locking?
Konrad