From patchwork Fri Jun 24 08:04:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 12894107 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 643AFC43334 for ; Fri, 24 Jun 2022 08:05:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1FBE6112C20; Fri, 24 Jun 2022 08:04:57 +0000 (UTC) Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6CB2F112C01; Fri, 24 Jun 2022 08:04:55 +0000 (UTC) Received: by mail-ed1-x52c.google.com with SMTP id c65so2327040edf.4; Fri, 24 Jun 2022 01:04:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SN2tXnkiXYHDkRcNluGEiWD+Zcie7EgTba4v+LS00Rw=; b=CjcSe9wc4EjfAkbjkiF8NJM6p2V4TBIzx/MVoQMmpgiPsjLyR+gRuRTFEYB3Ktsmj6 uDAJoHxOnz8/QuPN6vTSy5gLwbvZIrxGeq6qoPabZTcRU6gXi4B9UgKRuVNDxdOuXcL1 cxd/73iXXQR+fr9ZjFoDFmjR0cLQM1R0DIR2jGAJPqHq78r8H+21zwbEgz340DrDdfqf X5N2BIdOCyjdEdUdAOIQhfOYFDl6u7OALHxEmKZyWH8er7gOe7gpZJPRqEWHVjjT+Zda LFVWx/ojsAy6fLSK9XLReier7Yc/aQFSo1vJ6Ffb4pLtiw1aDQ3/hGk/ftltPnqcfrJN mArQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SN2tXnkiXYHDkRcNluGEiWD+Zcie7EgTba4v+LS00Rw=; b=5Ll1rqaRGm/BqcPT412mRHi/Ul+Jvuv+QpezTWS6327qxyounJmaaHjSRsh25xldvO 2MKm8zkxl91YUeFExgEgmy1jS3C+ULGKtUWXXtn8cKcxzQeWPiOMk6VavWD7JCopvurZ RhaOoo1sW0D3YZkNTN33DwFBGZnKcRyWQW0nGudtDcgatpdLyA8AZRSXav0wufw3OKER L+ITsZZ4O11rlsKjoMH77XKVLCtQnfCmtuDKfy/H+VcCIepUq6G562Rw9Ui4MLcufBey takSjBPWU8/9szDRlprI2P+jr6vB/SHwTulcKQyCsca/M/c8N07mkPIrTEodurLI1WJp /l5Q== X-Gm-Message-State: AJIora/vqu+lroBz44Qis/YOJRvRVyAspEIS4z+QaeLyZAEfTTttAvWq 9CcCNlnXlt6PFG7V1l73sNVOUUGLwi0= X-Google-Smtp-Source: AGRyM1tBvj71cbsgZ5j4wXJcKfxDt7AmGXAvH0woqtRU4by1QVnuj6MIlbtq+6gf5TBsdwCsD9lmDQ== X-Received: by 2002:aa7:d296:0:b0:435:7f33:38bc with SMTP id w22-20020aa7d296000000b004357f3338bcmr15804834edq.399.1656057893977; Fri, 24 Jun 2022 01:04:53 -0700 (PDT) Received: from able.fritz.box (p57b0bd9f.dip0.t-ipconnect.de. [87.176.189.159]) by smtp.gmail.com with ESMTPSA id c19-20020a170906155300b006fea43db5c1sm697779ejd.21.2022.06.24.01.04.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 01:04:53 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dri-devel@lists.freedesktop.org Date: Fri, 24 Jun 2022 10:04:35 +0200 Message-Id: <20220624080444.7619-6-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220624080444.7619-1-christian.koenig@amd.com> References: <20220624080444.7619-1-christian.koenig@amd.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 05/14] dma-buf: provide file RSS for DMA-buf files X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mhocko@suse.com, =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Just return the size of the DMA-buf in pages since pages allocated or mapped through DMA-bufs are usually not accounted elsewhere. Signed-off-by: Christian König --- drivers/dma-buf/dma-buf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 630133284e2b..16162ec3538c 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -494,6 +494,11 @@ static void dma_buf_show_fdinfo(struct seq_file *m, struct file *file) spin_unlock(&dmabuf->name_lock); } +static long dma_buf_file_rss(struct file *file) +{ + return i_size_read(file_inode(file)) >> PAGE_SHIFT; +} + static const struct file_operations dma_buf_fops = { .release = dma_buf_file_release, .mmap = dma_buf_mmap_internal, @@ -502,6 +507,7 @@ static const struct file_operations dma_buf_fops = { .unlocked_ioctl = dma_buf_ioctl, .compat_ioctl = compat_ptr_ioctl, .show_fdinfo = dma_buf_show_fdinfo, + .file_rss = dma_buf_file_rss, }; /*