mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
drm/ttm: apply the swapout bulk_move fix to the intended condition
Commit3db7d7d583("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:3db7d7d583("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> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Christian König <christian.koenig@amd.com> Link: https://lore.kernel.org/r/20260910143451.65853-1-bub4z0r@gmail.com
This commit is contained in:
parent
3db7d7d583
commit
fcfe64715b
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user