Linux-Media Archive on lore.kernel.org
 help / color / Atom feed
From: Peter Enderborg <peter.enderborg@sony.com>
To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Christian König" <christian.koenig@amd.com>,
	"Alexey Dobriyan" <adobriyan@gmail.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Muchun Song" <songmuchun@bytedance.com>,
	"Roman Gushchin" <guro@fb.com>,
	"Shakeel Butt" <shakeelb@google.com>,
	"Michal Hocko" <mhocko@suse.com>, NeilBrown <neilb@suse.de>,
	"Sami Tolvanen" <samitolvanen@google.com>,
	"Mike Rapoport" <rppt@kernel.org>,
	linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org,
	"Matthew Wilcox" <willy@infradead.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Kees Cook" <keescook@chromium.org>,
	"Mauro Carvalho Chehab" <mchehab+huawei@kernel.org>,
	"Alexey Gladkov" <gladkov.alexey@gmail.com>,
	"Feng Tang" <feng.tang@intel.com>,
	linux-doc@vger.kernel.org
Cc: Peter Enderborg <peter.enderborg@sony.com>
Subject: [PATCH 2/2 V6] lib/show_mem.c:  Add dma-buf counter to show_mem dump.
Date: Tue, 20 Apr 2021 10:22:20 +0200
Message-ID: <20210420082220.7402-3-peter.enderborg@sony.com> (raw)
In-Reply-To: <20210420082220.7402-1-peter.enderborg@sony.com>

On system where dma-buf is used it can be many clients that adds up
to a lot of memory. This can be relevant for OOM handling when
running out of memory or how system handle this memory. It may be to free
with a kill.

Suggested-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Peter Enderborg <peter.enderborg@sony.com>
---
 lib/show_mem.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/show_mem.c b/lib/show_mem.c
index 1c26c14ffbb9..ec4748c64353 100644
--- a/lib/show_mem.c
+++ b/lib/show_mem.c
@@ -7,6 +7,7 @@
 
 #include <linux/mm.h>
 #include <linux/cma.h>
+#include <linux/dma-buf.h>
 
 void show_mem(unsigned int filter, nodemask_t *nodemask)
 {
@@ -41,4 +42,8 @@ void show_mem(unsigned int filter, nodemask_t *nodemask)
 #ifdef CONFIG_MEMORY_FAILURE
 	printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages));
 #endif
+#ifdef CONFIG_DMA_SHARED_BUFFER
+	printk("%lu pages dma-buf\n", dma_buf_allocated_pages());
+#endif
+
 }
-- 
2.17.1


  parent reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20  8:22 [PATCH 0/2 V6]Add dma-buf counter Peter Enderborg
2021-04-20  8:22 ` [PATCH 1/2 V6] dma-buf: Add DmaBufTotal counter in meminfo Peter Enderborg
2021-04-20  8:22 ` Peter Enderborg [this message]
2021-04-20  8:30 ` [PATCH 0/2 V6]Add dma-buf counter Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210420082220.7402-3-peter.enderborg@sony.com \
    --to=peter.enderborg@sony.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=christian.koenig@amd.com \
    --cc=corbet@lwn.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=feng.tang@intel.com \
    --cc=gladkov.alexey@gmail.com \
    --cc=guro@fb.com \
    --cc=keescook@chromium.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab+huawei@kernel.org \
    --cc=mhocko@suse.com \
    --cc=neilb@suse.de \
    --cc=rdunlap@infradead.org \
    --cc=rppt@kernel.org \
    --cc=samitolvanen@google.com \
    --cc=shakeelb@google.com \
    --cc=songmuchun@bytedance.com \
    --cc=sumit.semwal@linaro.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Media Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-media/0 linux-media/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-media linux-media/ https://lore.kernel.org/linux-media \
		linux-media@vger.kernel.org
	public-inbox-index linux-media

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-media


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git