linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Kefeng Wang <wangkefeng.wang@huawei.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: Yongqiang Liu <liuyongqiang13@huawei.com>
Subject: Re: [PATCH v2] mm: add warning if __vm_enough_memory fails
Date: Wed, 10 Aug 2022 10:32:26 +0200	[thread overview]
Message-ID: <f3da23f5-950a-9569-20b3-f7d4779a69f7@redhat.com> (raw)
In-Reply-To: <20220726145428.8030-1-wangkefeng.wang@huawei.com>

On 26.07.22 16:54, Kefeng Wang wrote:
> 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>
> ---
> v2: use pr_warn_ratelimited, suggested by David Hildenbrand
> 
>  mm/util.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/mm/util.c b/mm/util.c
> index 1266a33a49ea..c786e21c6051 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_ratelimited("%s: pid: %d, comm: %s, no enough memory for the allocation\n",
> +			    __func__, current->pid, current->comm);
>  	vm_unacct_memory(pages);
>  
>  	return -ENOMEM;

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb



      parent reply	other threads:[~2022-08-10  8:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26 14:54 Kefeng Wang
2022-08-09  8:32 ` Kefeng Wang
2022-08-10  2:02   ` Andrew Morton
2022-08-10  6:19     ` Kefeng Wang
2022-08-10  8:32 ` David Hildenbrand [this message]

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=f3da23f5-950a-9569-20b3-f7d4779a69f7@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liuyongqiang13@huawei.com \
    --cc=wangkefeng.wang@huawei.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox