From patchwork Sun Apr 24 19:04:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12825049 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 39F79C4332F for ; Sun, 24 Apr 2022 19:05:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8BCC1112406; Sun, 24 Apr 2022 19:05:31 +0000 (UTC) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4A6FC10FEB9 for ; Sun, 24 Apr 2022 19:05:08 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: dmitry.osipenko) with ESMTPSA id 423BF1F44DB3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1650827107; bh=v+jC0YBB4Q1BHtuN+QSR1N9z8+FgGIDkfR2SgOwOH1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dQZUF6UHZhc4aQV6I+8YCzzf0nwtfM6G8rjdEz0XemNXO4l75m8rPbvP1/IEK6R7u cizJD0xfpYI7U4Ifc+ExN+4gRqDGF7qUio413Ar1LLCsMfl13thRZs5Ml9FSqfAt9p Mtu13Nlart7C7CJj+ZNLnBSc5L6i79QRSAH9RZCtgfxRQ0N7nURFSRkW2iL81gMGqg x00/HmwsoMwKVcoHg93sBPHx55uRCpNhVsssGAorv6/CexZbF1/olfxB1DZmERhdOl +EQuMF0k9ACRM6Afw5eyMoFVkTyT38owkQwoXYwVQfMSudBjb1TiRovoPmJqnNf+AH ZzYkUTyZMl6BQ== From: Dmitry Osipenko To: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Daniel Almeida , Gert Wollny , Gustavo Padovan , Daniel Stone , Tomeu Vizoso , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Steven Price , Alyssa Rosenzweig , Rob Clark , Emil Velikov , Robin Murphy , Qiang Yu , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= Subject: [PATCH v5 16/17] drm/shmem-helper: Make drm_gem_shmem_is_purgeable() private Date: Sun, 24 Apr 2022 22:04:23 +0300 Message-Id: <20220424190424.540501-17-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220424190424.540501-1-dmitry.osipenko@collabora.com> References: <20220424190424.540501-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 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: , Cc: Dmitry Osipenko , Dmitry Osipenko , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Panfrost driver was the only user of the drm_gem_shmem_is_purgeable() helper. Panfrost driver was converted to use new generic memory shrinker and the helper doesn't have external users anymore, hence make it private to the drm_gem_shmem_helper.c to keep the code clean. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 9 ++++++++- include/drm/drm_gem_shmem_helper.h | 7 ------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index 7ec5f8002f68..045921ad4795 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -169,6 +169,13 @@ static bool drm_gem_shmem_is_evictable(struct drm_gem_shmem_object *shmem) !shmem->base.import_attach && shmem->sgt && !shmem->evicted; } +static bool drm_gem_shmem_is_purgeable(struct drm_gem_shmem_object *shmem) +{ + return (shmem->madv > 0) && !shmem->purge_disable_count && + !shmem->vmap_use_count && !shmem->base.dma_buf && + !shmem->base.import_attach && shmem->sgt; +} + static void drm_gem_shmem_update_pages_state_locked(struct drm_gem_shmem_object *shmem) { @@ -182,7 +189,7 @@ drm_gem_shmem_update_pages_state_locked(struct drm_gem_shmem_object *shmem) mutex_lock(&gem_shrinker->lock); - if (drm_gem_shmem_is_purgeable(shmem) && !shmem->purge_disable_count) { + if (drm_gem_shmem_is_purgeable(shmem)) { drm_gem_shmem_add_pages_to_shrinker(shmem); list_move_tail(&shmem->madv_list, &gem_shrinker->lru_purgeable); } else if (drm_gem_shmem_is_evictable(shmem)) { diff --git a/include/drm/drm_gem_shmem_helper.h b/include/drm/drm_gem_shmem_helper.h index 5b351933c293..972687bf9717 100644 --- a/include/drm/drm_gem_shmem_helper.h +++ b/include/drm/drm_gem_shmem_helper.h @@ -194,13 +194,6 @@ int drm_gem_shmem_madvise(struct drm_gem_shmem_object *shmem, int madv); int drm_gem_shmem_set_purgeable(struct drm_gem_shmem_object *shmem); int drm_gem_shmem_set_purgeable_and_evictable(struct drm_gem_shmem_object *shmem); -static inline bool drm_gem_shmem_is_purgeable(struct drm_gem_shmem_object *shmem) -{ - return (shmem->madv > 0) && - !shmem->vmap_use_count && shmem->sgt && - !shmem->base.dma_buf && !shmem->base.import_attach; -} - int drm_gem_shmem_swap_in_locked(struct drm_gem_shmem_object *shmem); void drm_gem_shmem_purge_locked(struct drm_gem_shmem_object *shmem);