From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: dri-devel@lists.freedesktop.org, cgroups@vger.kernel.org,
intel-xe@lists.freedesktop.org
Cc: Daniel Vetter <daniel@ffwll.ch>,
Thomas Zimmermann <tzimmermann@suse.de>,
intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
amd-gfx@lists.freedesktop.org, Maxime Ripard <mripard@kernel.org>,
Zefan Li <lizefan.x@bytedance.com>,
Johannes Weiner <hannes@cmpxchg.org>, Tejun Heo <tj@kernel.org>,
David Airlie <airlied@gmail.com>
Subject: [Intel-gfx] [RFC PATCH 3/4] drm/ttm: Handle -EAGAIN in ttm_resource_alloc as -ENOSPC.
Date: Wed, 3 May 2023 10:34:59 +0200 [thread overview]
Message-ID: <20230503083500.645848-4-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <20230503083500.645848-1-maarten.lankhorst@linux.intel.com>
This allows the drm cgroup controller to return no space is available..
XXX: This is a hopeless simplification that changes behavior, and
returns -ENOSPC even if we could evict ourselves from the current
cgroup.
Ideally, the eviction code becomes cgroup aware, and will force eviction
from the current cgroup or its parents.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
drivers/gpu/drm/ttm/ttm_bo.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index bd5dae4d1624..e057d5d8f09a 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -731,6 +731,8 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo,
ret = ttm_resource_alloc(bo, place, mem);
if (likely(!ret))
break;
+ if (ret == -EAGAIN)
+ return -ENOSPC;
if (unlikely(ret != -ENOSPC))
return ret;
ret = ttm_mem_evict_first(bdev, man, place, ctx,
@@ -783,7 +785,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo,
type_found = true;
ret = ttm_resource_alloc(bo, place, mem);
- if (ret == -ENOSPC)
+ if (ret == -ENOSPC || ret == -EAGAIN)
continue;
if (unlikely(ret))
goto error;
--
2.34.1
next prev parent reply other threads:[~2023-05-03 8:36 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-03 8:34 [Intel-gfx] [RFC PATCH 0/4] Add support for DRM cgroup memory accounting Maarten Lankhorst
2023-05-03 8:34 ` [Intel-gfx] [RFC PATCH 1/4] cgroup: Add the DRM cgroup controller Maarten Lankhorst
2023-05-03 8:34 ` [Intel-gfx] [RFC PATCH 2/4] drm/cgroup: Add memory accounting to DRM cgroup Maarten Lankhorst
2023-05-03 15:31 ` Tvrtko Ursulin
2023-05-03 15:33 ` Maarten Lankhorst
2023-05-05 14:21 ` Maarten Lankhorst
2023-05-03 8:34 ` Maarten Lankhorst [this message]
2023-05-03 9:11 ` [Intel-gfx] [Intel-xe] [RFC PATCH 3/4] drm/ttm: Handle -EAGAIN in ttm_resource_alloc as -ENOSPC Thomas Hellström
2023-05-03 9:36 ` Maarten Lankhorst
2023-05-03 8:35 ` [Intel-gfx] [RFC PATCH 4/4] drm/xe: Add support for the drm cgroup Maarten Lankhorst
2023-05-03 9:54 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for Add support for DRM cgroup memory accounting Patchwork
2023-05-05 19:50 ` [Intel-gfx] [RFC PATCH 0/4] " Tejun Heo
2023-05-10 14:59 ` Maarten Lankhorst
2023-05-10 18:46 ` Tejun Heo
2023-05-11 10:03 ` Maarten Lankhorst
2023-05-11 10:14 ` Tvrtko Ursulin
2023-05-11 19:58 ` Maarten Lankhorst
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=20230503083500.645848-4-maarten.lankhorst@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=airlied@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=cgroups@vger.kernel.org \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hannes@cmpxchg.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=mripard@kernel.org \
--cc=tj@kernel.org \
--cc=tzimmermann@suse.de \
/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