All of 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 v7 2/2] drm/xe/shrinker: Take a runtime PM ref before shrinking non-system memory
Date: Wed, 09 Sep 2026 16:33:01 +0000	[thread overview]
Message-ID: <20260909163301.D63781F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260909162102.1097006-3-shuicheng.lin@intel.com>

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

Pre-existing issues:
- [High] Shrinker scan aborts entirely when encountering a single unsuitable buffer object.
--

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

drm/xe/shrinker: Take a runtime PM ref before shrinking non-system memory

This commit updates the xe shrinker to take a runtime PM reference before
walking non-system memory LRUs. It reuses the existing acquire path to resume
the device directly or queue a worker, and stops the scan early once the
target is met.

> diff --git a/drivers/gpu/drm/xe/xe_shrinker.c b/drivers/gpu/drm/xe/xe_shrinker.c
> index 89445cd202380..deb4378c1ec15 100644
> --- a/drivers/gpu/drm/xe/xe_shrinker.c
> +++ b/drivers/gpu/drm/xe/xe_shrinker.c
[ ... ]
> @@ -75,23 +101,35 @@ static int __xe_shrinker_walk(struct xe_device *xe,
>  		if (!man || !man->use_tt)
>  			continue;
>  
> +		if (mem_type != XE_PL_SYSTEM && !rpm &&
> +		    xe_device_is_l2_flush_optimized(xe)) {
> +			if (!__xe_shrinker_runtime_pm_get(shrinker))
> +				break;
> +			rpm = true;
> +		}
> +
>  		ttm_bo_lru_for_each_reserved_guarded(&curs, man, &arg, ttm_bo) {
>  			if (!ttm_bo_shrink_suitable(ttm_bo, ctx))
>  				continue;
>  
>  			lret = xe_bo_shrink(ctx, ttm_bo, flags, scanned);
> -			if (lret < 0)
> -				return lret;
> +			if (lret < 0) {
> +				ret = lret;
> +				goto out;
> +			}

[Severity: High]
This is a pre-existing issue, but does this inappropriately abort the entire
LRU traversal rather than skipping to the next buffer object when a non-fatal
error code is returned?

During the __xe_shrinker_walk() LRU iteration in
drivers/gpu/drm/xe/xe_shrinker.c, if xe_bo_shrink() returns -EBUSY, the loop
treats this as a fatal error and immediately aborts the entire scan via the
goto out branch.

This can happen frequently, such as when xe_bo_eviction_valuable() evaluates
to false:

drivers/gpu/drm/xe/xe_bo.c:xe_bo_shrink() {
	...
	if (!xe_bo_eviction_valuable(bo, &place))
		return -EBUSY;
	...
}

Will the memory shrinker fail to reclaim pages if it encounters a buffer
object that cannot be evicted, potentially leading to system OOM because
reclaim progress is permanently blocked by the first unsuitable BO?

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

  reply	other threads:[~2026-09-09 16:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09 16:21 [PATCH v7 0/2] drm/xe/shrinker: Runtime PM reference for non-system memory Shuicheng Lin
2026-09-09 16:21 ` [PATCH v7 1/2] drm/xe/shrinker: Return the freed page count through a parameter Shuicheng Lin
2026-09-09 16:29   ` sashiko-bot
2026-09-09 20:53     ` Lin, Shuicheng
2026-09-09 16:21 ` [PATCH v7 2/2] drm/xe/shrinker: Take a runtime PM ref before shrinking non-system memory Shuicheng Lin
2026-09-09 16:33   ` sashiko-bot [this message]
2026-09-09 17:50 ` ✓ CI.KUnit: success for drm/xe/shrinker: Runtime PM reference for non-system memory (rev2) Patchwork
2026-09-09 18:56 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-09-10 15:53   ` Lin, Shuicheng
2026-09-10  4:49 ` ✗ Xe.CI.FULL: " Patchwork
2026-09-10 15:47   ` Lin, Shuicheng

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=20260909163301.D63781F000FF@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.