From nobody Thu Feb 12 00:03:15 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A57D5C77B75 for ; Wed, 3 May 2023 09:00:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229693AbjECJAU (ORCPT ); Wed, 3 May 2023 05:00:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjECJAR (ORCPT ); Wed, 3 May 2023 05:00:17 -0400 X-Greylist: delayed 1143 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 03 May 2023 02:00:15 PDT Received: from mblankhorst.nl (lankhorst.se [IPv6:2a02:2308:0:7ec:e79c:4e97:b6c4:f0ae]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26EF92700; Wed, 3 May 2023 02:00:14 -0700 (PDT) From: Maarten Lankhorst To: dri-devel@lists.freedesktop.org, cgroups@vger.kernel.org, intel-xe@lists.freedesktop.org Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, Tejun Heo , Zefan Li , Johannes Weiner , David Airlie , Daniel Vetter , amd-gfx@lists.freedesktop.org, Maxime Ripard , Thomas Zimmermann , Maarten Lankhorst , Tvrtko Ursulin Subject: [RFC PATCH 3/4] drm/ttm: Handle -EAGAIN in ttm_resource_alloc as -ENOSPC. Date: Wed, 3 May 2023 10:34:59 +0200 Message-Id: <20230503083500.645848-4-maarten.lankhorst@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230503083500.645848-1-maarten.lankhorst@linux.intel.com> References: <20230503083500.645848-1-maarten.lankhorst@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- 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_obj= ect *bo, ret =3D ttm_resource_alloc(bo, place, mem); if (likely(!ret)) break; + if (ret =3D=3D -EAGAIN) + return -ENOSPC; if (unlikely(ret !=3D -ENOSPC)) return ret; ret =3D ttm_mem_evict_first(bdev, man, place, ctx, @@ -783,7 +785,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, =20 type_found =3D true; ret =3D ttm_resource_alloc(bo, place, mem); - if (ret =3D=3D -ENOSPC) + if (ret =3D=3D -ENOSPC || ret =3D=3D -EAGAIN) continue; if (unlikely(ret)) goto error; --=20 2.34.1