Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Shuicheng Lin" <shuicheng.lin@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v6 1/2] drm/xe/shrinker: Return the freed page count through a parameter
Date: Fri, 04 Sep 2026 21:59:16 +0000	[thread overview]
Message-ID: <20260904215916.C76C11F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260904215049.543535-2-shuicheng.lin@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] The shrinker scan aborts completely upon encountering a non-eligible BO, degrading reclaim effectiveness.
--

commit f040cd7950a53bb8a92b925733431f658c554101
Author: Shuicheng Lin <shuicheng.lin@intel.com>

drm/xe/shrinker: Return the freed page count through a parameter

This patch updates the xe_shrinker_walk and __xe_shrinker_walk functions to
return the number of freed pages through a pointer parameter. This prevents 
accumulated freed page counts from being discarded if an error occurs later
in the scan.

Fixes: 00c8efc3180f ("drm/xe: Add a shrinker for xe bos")

> diff --git a/drivers/gpu/drm/xe/xe_shrinker.c b/drivers/gpu/drm/xe/xe_shrinker.c
> index 83374cd576608..89445cd202380 100644
> --- a/drivers/gpu/drm/xe/xe_shrinker.c
> +++ b/drivers/gpu/drm/xe/xe_shrinker.c

[ ... ]

> @@ -82,7 +83,7 @@ static s64 __xe_shrinker_walk(struct xe_device *xe,
>  			if (lret < 0)
>  				return lret;

[Severity: High]
This is a pre-existing issue, but does this logic prematurely abort the
shrinker scan?

When xe_shrinker_scan() initiates a shrinker walk with shrink_flags.purge set
to true, __xe_shrinker_walk() iterates over the TTM LRU list. For each BO, it
calls xe_bo_shrink().

If flags.purge is true but the BO itself is not purgeable, xe_bo_shrink() in
drivers/gpu/drm/xe/xe_bo.c intentionally returns -EBUSY:

xe_bo_shrink() {
        ...
        if (!(tt->page_flags & TTM_TT_FLAG_EXTERNAL_MAPPABLE) ||
            (flags.purge && !xe_tt->purgeable))
                return -EBUSY;
        ...
}

Because -EBUSY is less than 0, __xe_shrinker_walk() will immediately abort
the entire scan instead of skipping the ineligible BO and continuing to the
next one.

Could this lead to poor reclaim effectiveness and potential out-of-memory
conditions if the shrinker encounters a single non-purgeable buffer object
on the LRU list?

> -			freed += lret;
> +			*freed += lret;
>  			if (*scanned >= to_scan)
>  				break;
>  		}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260904215049.543535-1-shuicheng.lin@intel.com?part=1

  reply	other threads:[~2026-09-04 21:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 21:50 [PATCH v6 0/2] drm/xe/shrinker: Runtime PM reference for non-system memory Shuicheng Lin
2026-09-04 21:50 ` [PATCH v6 1/2] drm/xe/shrinker: Return the freed page count through a parameter Shuicheng Lin
2026-09-04 21:59   ` sashiko-bot [this message]
2026-09-09 12:58   ` Thomas Hellström
2026-09-04 21:50 ` [PATCH v6 2/2] drm/xe/shrinker: Take a runtime PM ref before shrinking non-system memory Shuicheng Lin
2026-09-04 22:05   ` sashiko-bot
2026-09-07  8:23   ` Thomas Hellström
2026-09-04 22:10 ` ✓ CI.KUnit: success for drm/xe/shrinker: Runtime PM reference for " Patchwork
2026-09-04 23:05 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-05  4:15 ` ✓ Xe.CI.FULL: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260904215916.C76C11F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shuicheng.lin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox