Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2616282pxb; Sun, 24 Apr 2022 21:04:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFbUlMp6jF1OijVSCMrT7bll0fs3P+gWhNCEHGUSJvSX0UabCpGlH9pp3hamIMCRZLsqXi X-Received: by 2002:a17:907:1c13:b0:6f0:106f:6c90 with SMTP id nc19-20020a1709071c1300b006f0106f6c90mr14987793ejc.504.1650859479106; Sun, 24 Apr 2022 21:04:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650859479; cv=none; d=google.com; s=arc-20160816; b=giPjjxvSqNhB2paM2u/fgtHGNzIpm2k4YwNb4JZo1mjLRzBFGjEEqSevApcckTaheB mGCpw1IKmUc66nPVhAAr6il4Vwzx6Xa29+icmqWjd/qZBHenNOBkPEWES3jun64MQ4+M C3doRT5C4YrAUq49ypVsCYIH8HkMCySmtNg1PeRD4uxpl3tJembEVH6dZJuSAMxmKj2R WKKP20yJCxOOwRCRs/LzMD/tUYKbevjP1M+p+L8+0D/+cQcIiErKPn36jnuOfgZNdadq sA9WhEdUkS+IZ4Q8CBzXiLehabStPAJHE8n7dMDJF1+5a9ox9ApSWJpNctp1wWUNhBd5 9Icg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2p2amDdAiu+lwyUcBhEnyqxcgL9A9W0xaOfy7N5oxr0=; b=GSgENjXjhuJge2gXP0uf0eaDcOmcMBafCYlHYgHfoMcodrWUzA5M8+623N8/hmiHMB KC29Cmtj32QAinrTL+/hJ86XAt6Mer6xp8RvlNwLJv9HtBBU6ETbSK0jbiLt7uVgv38z gOeSzB5vvHTmCE3cvqj5fEtGnqbBIkToivkGIcXcKCAYUGtbArcnWgKWizHKqQPY7483 gcfL1fXIC2IqolygHaHTPxbfH0BFbDc25QI9dvQ3cwSd4NMV5fOvo+Nx9xO0i9pc1AHy 6adZEuHEm4iEm9F4bOMw6SiEiqHHQRfXS/S9CFUVdorl6DAmxmGoUGX10McVsfJgUvYP BRvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=dQZUF6UH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk6-20020a170906b0c600b006f372b0ce85si5405934ejb.680.2022.04.24.21.04.12; Sun, 24 Apr 2022 21:04:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=dQZUF6UH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238226AbiDXTJ2 (ORCPT + 99 others); Sun, 24 Apr 2022 15:09:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238049AbiDXTIS (ORCPT ); Sun, 24 Apr 2022 15:08:18 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97A4114085 for ; Sun, 24 Apr 2022 12:05:08 -0700 (PDT) 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=20K=C3=B6nig?= Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Dmitry Osipenko , Dmitry Osipenko 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.35.1