summaryrefslogtreecommitdiff
path: root/mm/util.c
diff options
context:
space:
mode:
authorKefeng Wang <wangkefeng.wang@huawei.com>2022-07-26 17:54:28 +0300
committerAndrew Morton <akpm@linux-foundation.org>2022-09-12 06:25:54 +0300
commit44b414c8715c5dcf53288ce9005d7b24cc90eaf5 (patch)
treeb305a8681b7a5e49b3a5b90f5ae6784fab43a68b /mm/util.c
parent4d86d4f7227c6f2acfbbbe0623d49865aa71b756 (diff)
downloadlinux-44b414c8715c5dcf53288ce9005d7b24cc90eaf5.tar.xz
mm/util.c: add warning if __vm_enough_memory fails
If a process has not enough memory to allocate a new virtual mapping, we may meet verious 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 easily to check this scenario if __vm_enough_memory fails. Link: https://lkml.kernel.org/r/20220726145428.8030-1-wangkefeng.wang@huawei.com Reported-by: Yongqiang Liu <liuyongqiang13@huawei.com> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Acked-by: David Hildenbrand <david@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/util.c')
-rw-r--r--mm/util.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/util.c b/mm/util.c
index f0cf92b8826e..8d944ce71e94 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -1052,6 +1052,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_ratelimited("%s: pid: %d, comm: %s, no enough memory for the allocation\n",
+ __func__, current->pid, current->comm);
vm_unacct_memory(pages);
return -ENOMEM;