From mboxrd@z Thu Jan 1 00:00:00 1970 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E8E5E7DEFB for ; Mon, 2 Feb 2026 16:05:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9710C10E50D; Mon, 2 Feb 2026 16:05:35 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by gabe.freedesktop.org (Postfix) with ESMTP id 2C57010E50D for ; Mon, 2 Feb 2026 16:05:34 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2CA34339; Mon, 2 Feb 2026 08:05:27 -0800 (PST) Received: from [10.57.6.209] (unknown [10.57.6.209]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ED81E3F778; Mon, 2 Feb 2026 08:05:29 -0800 (PST) Message-ID: <22b5695c-e9c9-4470-be72-d428bc495a28@arm.com> Date: Mon, 2 Feb 2026 16:05:28 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/8] drm/gem: Consider GEM object reclaimable if shrinking fails To: Boris Brezillon , Liviu Dudau , =?UTF-8?Q?Adri=C3=A1n_Larumbe?= Cc: dri-devel@lists.freedesktop.org, David Airlie , Simona Vetter , Akash Goel , Rob Clark , Sean Paul , Konrad Dybcio , Akhil P Oommen , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Dmitry Osipenko , Chris Diamand , Danilo Krummrich , Matthew Brost , =?UTF-8?Q?Thomas_Hellstr=C3=B6m?= , Alice Ryhl , kernel@collabora.com References: <20260202113607.1745667-1-boris.brezillon@collabora.com> <20260202113607.1745667-2-boris.brezillon@collabora.com> From: Steven Price Content-Language: en-GB In-Reply-To: <20260202113607.1745667-2-boris.brezillon@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 02/02/2026 11:36, Boris Brezillon wrote: > If the object wasn't moved to a different LRU after the shrink callback > returns, it means the buffer is still reclaimable. Update the remaining > counter to reflect that. > > v2: > - Collect R-b > > Signed-off-by: Boris Brezillon > Reviewed-by: Liviu Dudau Reviewed-by: Steven Price > --- > drivers/gpu/drm/drm_gem.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c > index f7cbf6e8d1e0..442853511106 100644 > --- a/drivers/gpu/drm/drm_gem.c > +++ b/drivers/gpu/drm/drm_gem.c > @@ -1671,6 +1671,16 @@ drm_gem_lru_scan(struct drm_gem_lru *lru, > */ > WARN_ON(obj->lru == &still_in_lru); > WARN_ON(obj->lru == lru); > + } else if (obj->lru == &still_in_lru) { > + /* > + * If the object wasn't moved and wasn't shrunk either, > + * it's still remaining as reclaimable. Note that > + * obj->lru is supposed to be checked with the LRU lock > + * held for an accurate result, but we don't care about > + * accuracy here. Worst thing that could happen is an > + * extra scan. > + */ > + *remaining += obj->size >> PAGE_SHIFT; > } > > dma_resv_unlock(obj->resv);