Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp146539rwl; Tue, 11 Apr 2023 16:00:24 -0700 (PDT) X-Google-Smtp-Source: AKy350beFZY00s2VDk8+zZRP4JD1fCWRy77KUhSyiJyJO3kI+9DTmjKfGZaLrERVu47wiQNXee1V X-Received: by 2002:a05:6a20:3b92:b0:eb:8185:e992 with SMTP id b18-20020a056a203b9200b000eb8185e992mr390590pzh.48.1681254023975; Tue, 11 Apr 2023 16:00:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681254023; cv=none; d=google.com; s=arc-20160816; b=wXPJ2s2xipQzy0gpbiy1b9Evd+eSk7pcmLAwsMz9aUBBzKDepCiSzv1BByjda4LQJ8 luLC7de1hmUdQRSD1RaCJmfH+f+f+55WEuVknyatyB5sVbj3wC189DFUUqOVKGTgFpbx Cg0ObfSTWyVSpZ2Jo1W/DjU+DrsGq60O/xtDTguX+3sLUlbqlB62nSHBf0jGpUW1viYT 5P825zW4JKXMav2F7ue0q9kffa4KM0mRoPnjhUW90bRm3usDZjUf96e4E4mWjtObF8ne G1a72uDnN3tLd4Byo7jt+Vd7CpMVE4vfKhkha5Uq+/GVwX+llXfZv2e6xfgAQAqK5gLz Up1Q== 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=ayU9yxyS63GOBM6CjiiY8bjBwmD9ZnU8dUfgj0+el7c=; b=AOu0yamQ9umu5BXe3zQIYk9RP8v6fmJ4sbi1dT93+T2fFIAWwdULvPEaPCguZFX6Ri 8+PLuxkJC+C7RZaW3SNF/s7ZVa8qw1PMuI94jBIpUT0c5GsVvbWO8Q+dSkjMkQAm5+sY l6tritMf7C8RLijx/w6BYWYedyNh7MAQwXxJmO8B6VHby6FISvyqEPejcHWdeu+3sRiw NneT+x7CpBkg0FcHqEfp8HN81cJsB+BfvRLrajAFbIhnQG9tyrgqwsErJwi0lVau1Ihp wywF3BA8gq4VX/dUqQZFmWo73iAesYkOH7S11LhAX8JluALTmsKa60qUqKawI6bE8efG 0y7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=VHMVks6N; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y18-20020aa79e12000000b0063afadfceeasi1199376pfq.29.2023.04.11.16.00.11; Tue, 11 Apr 2023 16:00:23 -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=@gmail.com header.s=20221208 header.b=VHMVks6N; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229738AbjDKW62 (ORCPT + 99 others); Tue, 11 Apr 2023 18:58:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229745AbjDKW6O (ORCPT ); Tue, 11 Apr 2023 18:58:14 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B1322D63; Tue, 11 Apr 2023 15:58:08 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id q2so14282340pll.7; Tue, 11 Apr 2023 15:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681253881; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ayU9yxyS63GOBM6CjiiY8bjBwmD9ZnU8dUfgj0+el7c=; b=VHMVks6NvFNA2/mOKdow01yeN+D6kqEpVibmOQv1tGWfHDT2poOsnsKr7eTZ7pHDvD DJY9EFVJaynf/OAjF0rD5h8BRBfY/Nw/R0RnOGYwnDSaz/5zPj5ZEl+RUp8zC7F/fEhs x0H7SQF0GF6TFrorb4/00O1gYYJ8B4QdsyIE86JVC6N4ywG1DB2S9J1uP22usScfEJWf 1dNBvgS2a9bRLfmrPzRWj1BWlbBEs13UEMUl1WBPeS69+JumPmo5V6CEg2Qnaj4jlk+n Y0Phzi7RUHipcV/fBRkNwMFXd7mbOCJBMgHT1G4kHzuXt4KaVnrvFYoi7YV7MCNfwHc8 hZDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681253881; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ayU9yxyS63GOBM6CjiiY8bjBwmD9ZnU8dUfgj0+el7c=; b=rq2cTS6GT3X9uGNSzoxUTbQYx9RmQ1apTlo1JEXNNKTwjMqX8fP17ZM0OwmetoYt12 h9Gx1z3n4R9xLTkLeQ5nMUqdpYTee6gjS04DAaCNKHRr6tOH1wb7S5Rd7B6tvSMJYSpS 2Z8i6zMbQq8KYeABgfNJjfu75F+sncPV7efZyIsgSoGAawsAcA5X7g7zf3z7u0HTrJIS rIISNhpMRtput+p8Id0/Ine41KYxkBGn39ubHfjz6FG/L1JZuMjODFpz1G+MFtiF/o1g Vl7MDIioqIDfdlRtMWOpkEWXEGRKcwZNiSb5+/vOtPR7Ksv+5CuDGPMvSvh3ZugL6HfY moHQ== X-Gm-Message-State: AAQBX9c0oBWDZCtPAntrid9eZP//KyFR0ju8utc4Pmxnqnk59Lo5jceH NtuFtDNOPFopSxJteDXXedo= X-Received: by 2002:a17:903:11c9:b0:1a5:a1e:6f9e with SMTP id q9-20020a17090311c900b001a50a1e6f9emr142303plh.15.1681253881277; Tue, 11 Apr 2023 15:58:01 -0700 (PDT) Received: from localhost ([2a00:79e1:abd:4a00:61b:48ed:72ab:435b]) by smtp.gmail.com with ESMTPSA id a11-20020a170902900b00b00196807b5189sm10087161plp.292.2023.04.11.15.58.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Apr 2023 15:58:00 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Boris Brezillon , Tvrtko Ursulin , Christopher Healy , Emil Velikov , Rob Clark , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v3 7/7] drm/msm: Add memory stats to fdinfo Date: Tue, 11 Apr 2023 15:56:12 -0700 Message-Id: <20230411225725.2032862-8-robdclark@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230411225725.2032862-1-robdclark@gmail.com> References: <20230411225725.2032862-1-robdclark@gmail.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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 From: Rob Clark Use the new helper to export stats about memory usage. v2: Drop unintended hunk v3: Rebase Signed-off-by: Rob Clark Reviewed-by: Emil Velikov --- drivers/gpu/drm/msm/msm_gem.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index db6c4e281d75..c32264234ea1 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c @@ -1096,6 +1096,20 @@ int msm_gem_new_handle(struct drm_device *dev, struct drm_file *file, return ret; } +static enum drm_gem_object_status msm_gem_status(struct drm_gem_object *obj) +{ + struct msm_gem_object *msm_obj = to_msm_bo(obj); + enum drm_gem_object_status status = 0; + + if (msm_obj->pages) + status |= DRM_GEM_OBJECT_RESIDENT; + + if (msm_obj->madv == MSM_MADV_DONTNEED) + status |= DRM_GEM_OBJECT_PURGEABLE; + + return status; +} + static const struct vm_operations_struct vm_ops = { .fault = msm_gem_fault, .open = drm_gem_vm_open, @@ -1110,6 +1124,7 @@ static const struct drm_gem_object_funcs msm_gem_object_funcs = { .vmap = msm_gem_prime_vmap, .vunmap = msm_gem_prime_vunmap, .mmap = msm_gem_object_mmap, + .status = msm_gem_status, .vm_ops = &vm_ops, }; -- 2.39.2