linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Xu Huijie <xuhuijie2@huawei.com>
To: <linux-mm@kvack.org>
Cc: <wuxu.wu@huawei.com>
Subject: [PATCH] add kernel log when allocate a new virtual mapping failed because of overcommit
Date: Wed, 30 Jun 2021 15:44:33 +0800	[thread overview]
Message-ID: <20210630074433.41992-1-xuhuijie2@huawei.com> (raw)

From: xuhuijie <xuhuijie2@huawei.com>

diff --git a/mm/mmap.c b/mm/mmap.c
index aa9de981b..f019fc6b2 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1758,8 +1758,10 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
 	 */
 	if (accountable_mapping(file, vm_flags)) {
 		charged = len >> PAGE_SHIFT;
-		if (security_vm_enough_memory_mm(mm, charged))
+		if (security_vm_enough_memory_mm(mm, charged)) {
+			pr_err("Unable to allocate a new virtual mapping because of the overcommit\n");
 			return -ENOMEM;
+		}
 		vm_flags |= VM_ACCOUNT;
 	}
 
-- 
2.23.0



             reply	other threads:[~2021-06-30  7:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-30  7:44 Xu Huijie [this message]
2021-06-30 13:29 ` Matthew Wilcox

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=20210630074433.41992-1-xuhuijie2@huawei.com \
    --to=xuhuijie2@huawei.com \
    --cc=linux-mm@kvack.org \
    --cc=wuxu.wu@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