diff mbox series

[2/2,V6] lib/show_mem.c: Add dma-buf counter to show_mem dump.

Message ID 20210420082220.7402-3-peter.enderborg@sony.com (mailing list archive)
State New
Headers show
Series Add dma-buf counter | expand

Commit Message

peter enderborg April 20, 2021, 8:22 a.m. UTC
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 mbox series

Patch

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
+
 }