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: 12971598 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B950ECAAD3 for ; Fri, 9 Sep 2022 11:32:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ABD788D0006; Fri, 9 Sep 2022 07:32:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A45128D0002; Fri, 9 Sep 2022 07:32:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 895758D0006; Fri, 9 Sep 2022 07:32:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 7B28A8D0002 for ; Fri, 9 Sep 2022 07:32:09 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4C5CB8131E for ; Fri, 9 Sep 2022 11:32:09 +0000 (UTC) X-FDA: 79892333178.27.BD03386 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [85.220.165.71]) by imf22.hostedemail.com (Postfix) with ESMTP id 05932C009B for ; Fri, 9 Sep 2022 11:32:08 +0000 (UTC) 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-mm@kvack.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662723129; a=rsa-sha256; cv=none; b=Tc6Sqf2cWKZQd2pDFOuW+YyrADLIU00uoNFOcoY2H5+iFCRkglJhaXZy9eTa8t7WBFtB/H PUK7mFfIMBwdVveP9N8c6VjcXJEi+hxq2OwzNpp6yrdFTUTVzeT/bYEJDxhcN1VBKGjwKY f2F1Rst0+9WDmJXQu1tpKm0P5y9B6bs= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of l.stach@pengutronix.de designates 85.220.165.71 as permitted sender) smtp.mailfrom=l.stach@pengutronix.de; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662723129; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GiYH+wLILHVh2KvkX5YzE3kkzGn1y/KaA+m9GVJgvkw=; b=CB5/yhfTfilICrOmyf/GO1I1XjHpAwcAnuvs4xwuHqIQhOy0BDlhBrR0n/cPBSZfEB1RGC Xd3CZkZQLJz7c5v2GWdxkAVyI5tcfKHRjmO42NpPWHqSSoAv54KbYo2Hh7wIbGEjxm1mZ8 FVPl46kYyh2Y1e5xiShnDjgoTE8Jlr8= X-Stat-Signature: 3j5kwcrcmfwfsf1y7nffeegyfj11den5 X-Rspam-User: X-Rspamd-Queue-Id: 05932C009B X-Rspamd-Server: rspam07 Authentication-Results: imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of l.stach@pengutronix.de designates 85.220.165.71 as permitted sender) smtp.mailfrom=l.stach@pengutronix.de; dmarc=none X-HE-Tag: 1662723128-738709 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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);