From patchwork Fri Sep 9 11:16:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 12971575 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 07236ECAAA1 for ; Fri, 9 Sep 2022 11:16:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229751AbiIILQ4 (ORCPT ); Fri, 9 Sep 2022 07:16:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229747AbiIILQu (ORCPT ); Fri, 9 Sep 2022 07:16:50 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10570130D23 for ; Fri, 9 Sep 2022 04:16:50 -0700 (PDT) Received: from dude02.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::28]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1oWc06-0002dP-1w; Fri, 09 Sep 2022 13:16:46 +0200 From: Lucas Stach To: linux-mm@kvack.org, dri-devel@lists.freedesktop.org Cc: Daniel Vetter , David Airlie , Andrew Morton , Michal Hocko , =?utf-8?q?Christian_K=C3=B6nig?= , linux-fsdevel@vger.kernel.org, kernel@pengutronix.de Subject: [RFC PATCH 5/5] drm/etnaviv: account memory used by GEM buffers Date: Fri, 9 Sep 2022 13:16:40 +0200 Message-Id: <20220909111640.3789791-6-l.stach@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220909111640.3789791-1-l.stach@pengutronix.de> References: <20220909111640.3789791-1-l.stach@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:1101:1d::28 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-fsdevel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Etnaviv GEM buffers are pinned into memory as soon as we allocate the pages backing the object and only disappear when freeing the GEM object as there is no shrinker hooked up for unused buffers. Signed-off-by: Lucas Stach --- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c index cc386f8a7116..bf3d75b8e154 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c @@ -67,6 +67,8 @@ static int etnaviv_gem_shmem_get_pages(struct etnaviv_gem_object *etnaviv_obj) etnaviv_obj->pages = p; + drm_gem_add_resident(&etnaviv_obj->base); + return 0; } @@ -79,6 +81,7 @@ static void put_pages(struct etnaviv_gem_object *etnaviv_obj) etnaviv_obj->sgt = NULL; } if (etnaviv_obj->pages) { + drm_gem_dec_resident(&etnaviv_obj->base); drm_gem_put_pages(&etnaviv_obj->base, etnaviv_obj->pages, true, false);