linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: add warning if __vm_enough_memory fails
@ 2022-07-26  7:24 Kefeng Wang
  2022-07-26 13:45 ` David Hildenbrand
  0 siblings, 1 reply; 3+ messages in thread
From: Kefeng Wang @ 2022-07-26  7:24 UTC (permalink / raw)
  To: Andrew Morton, linux-mm, linux-kernel; +Cc: Kefeng Wang, Yongqiang Liu

If a process has no enough memory to allocate a new virtual mapping, we
may meet kinds of error, eg, fork cannot allocate memory, SIGBUS error
in shmem, but it is difficult to confirm them, let's add some debug
information to easy to check this scenario if __vm_enough_memory fails.

Reported-by: Yongqiang Liu <liuyongqiang13@huawei.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 mm/util.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/util.c b/mm/util.c
index 1266a33a49ea..19bfff8a0ad6 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -1020,6 +1020,8 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
 	if (percpu_counter_read_positive(&vm_committed_as) < allowed)
 		return 0;
 error:
+	pr_warn("%s: pid: %d, comm: %s, no enough memory for the allocation\n",
+		__func__, current->pid, current->comm);
 	vm_unacct_memory(pages);
 
 	return -ENOMEM;
-- 
2.35.3



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-26 14:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-26  7:24 [PATCH] mm: add warning if __vm_enough_memory fails Kefeng Wang
2022-07-26 13:45 ` David Hildenbrand
2022-07-26 14:42   ` Kefeng Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox