From nobody Wed Apr 15 05:48:41 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C5EEC433EF for ; Tue, 26 Jul 2022 07:18:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237893AbiGZHSk (ORCPT ); Tue, 26 Jul 2022 03:18:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237687AbiGZHSh (ORCPT ); Tue, 26 Jul 2022 03:18:37 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91A082A97B for ; Tue, 26 Jul 2022 00:18:36 -0700 (PDT) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LsSqf5730zjXVM; Tue, 26 Jul 2022 15:15:42 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 26 Jul 2022 15:17:55 +0800 Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 26 Jul 2022 15:17:54 +0800 From: Kefeng Wang To: Andrew Morton , , CC: Kefeng Wang , Yongqiang Liu Subject: [PATCH] mm: add warning if __vm_enough_memory fails Date: Tue, 26 Jul 2022 15:24:51 +0800 Message-ID: <20220726072451.142427-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Signed-off-by: Kefeng Wang --- 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 pag= es, 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); =20 return -ENOMEM; --=20 2.35.3