From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Vadim Nikitushkin <bub4z0r@gmail.com>, thomas.hellstrom@linux.intel.com
Cc: ray.huang@amd.com, matthew.auld@intel.com,
matthew.brost@intel.com, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
skainsworth@gmail.com, alexander.deucher@amd.com,
bernardomagri21@gmail.com
Subject: Re: [PATCH] drm/ttm: apply the swapout bulk_move fix to the intended condition
Date: Thu, 10 Sep 2026 18:07:05 +0200 [thread overview]
Message-ID: <e0d0c87a-7502-48cf-9d64-f383edbbacb9@gmail.com> (raw)
In-Reply-To: <20260910143451.65853-1-bub4z0r@gmail.com>
Hi Vadim,
On 9/10/26 16:34, Vadim Nikitushkin wrote:
> Commit 3db7d7d58341 ("drm/ttm: fix swapped-out resources never leaving
> their bulk_move range") landed in drm-misc-fixes with its one-line
> change applied to the wrong "if": the "if (ret)" after
> ttm_resource_try_charge() in ttm_bo_alloc_at_place() became
> "if (ret > 0)", while the "if (!ret)" after ttm_tt_swapout() in
> ttm_bo_swapout_cb() that the patch targeted was left untouched.
>
> ttm_resource_try_charge() returns 0 or a negative error code, so with
> "ret > 0" a failed dmem cgroup charge no longer fails the allocation.
> Restore that check and apply the intended change: ttm_tt_swapout()
> returns the number of pages swapped out on success, so the bulk_move
> removal must run for ret > 0.
>
> Fixes: 3db7d7d58341 ("drm/ttm: fix swapped-out resources never leaving their bulk_move range")
> Cc: stable@vger.kernel.org # v7.1+
> Signed-off-by: Vadim Nikitushkin <bub4z0r@gmail.com>
> ---
> Christian, the commit in drm-misc-fixes (3db7d7d58341) ended up with the
> change applied to the try_charge condition at line 532 instead of the
> swapout one at line 1434; the resulting tree still has "if (!ret)" in
> ttm_bo_swapout_cb(). This is a fix-up on top of 3db7d7d58341 since
> drm-misc-fixes does not rebase. Sorry for the noise.
Mea culpa.
AMDs mail servers convert incoming mail to a different encoding which prevents the patch from applying cleanly (yeah everybody knows how braindead that is).
Usually I pick up patches from patchwork now, but this time I though I could apply the one liner manually.
Well long story short that didn't worked the way it should.
I've just reviewed and pushed this patch to drm-misc-fixes as well.
Thanks a lot for helping out here.
Sorry,
Christian.
>
> drivers/gpu/drm/ttm/ttm_bo.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index a12af5b..9b85b5f 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -532,7 +532,7 @@ static int ttm_bo_alloc_at_place(struct ttm_buffer_object *bo,
> ret = ttm_resource_try_charge(bo, place, &alloc_state->charge_pool,
> force_space ? &alloc_state->limit_pool
> : NULL);
> - if (ret > 0) {
> + if (ret) {
> /*
> * -EAGAIN means the charge failed, which we treat
> * like an allocation failure. Therefore, return an
> @@ -1434,7 +1434,7 @@ ttm_bo_swapout_cb(struct ttm_lru_walk *walk, struct ttm_buffer_object *bo)
>
> if (ttm_tt_is_populated(tt)) {
> ret = ttm_tt_swapout(bdev, tt, swapout_walk->gfp_flags);
> - if (!ret) {
> + if (ret > 0) {
> spin_lock(&bdev->lru_lock);
> ttm_resource_del_bulk_move_unevictable(bo->resource, bo);
> ttm_resource_move_to_lru_tail(bo->resource);
> --
> 2.53.0
>
next prev parent reply other threads:[~2026-09-10 16:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 20:50 [PATCH] drm/ttm: fix swapped-out resources never leaving their bulk_move range Vadim Nikitushkin
2026-09-10 7:14 ` Thomas Hellström
2026-09-10 7:46 ` Christian König
2026-09-10 14:34 ` [PATCH] drm/ttm: apply the swapout bulk_move fix to the intended condition Vadim Nikitushkin
2026-09-10 16:07 ` Christian König [this message]
2026-09-11 16:08 ` [PATCH] drm/ttm: fix swapped-out resources never leaving their bulk_move range Samuel Ainsworth
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=e0d0c87a-7502-48cf-9d64-f383edbbacb9@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=bernardomagri21@gmail.com \
--cc=bub4z0r@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.auld@intel.com \
--cc=matthew.brost@intel.com \
--cc=ray.huang@amd.com \
--cc=skainsworth@gmail.com \
--cc=stable@vger.kernel.org \
--cc=thomas.hellstrom@linux.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
all inboxes | Powered by JetHome®