Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5658845rwb; Tue, 9 Aug 2022 01:40:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR7PzvtsTAN5KhpipOaf6rpM+ov6HCf1rV1/y5rgSkO3+ujS5QDj7KUf/SJeZPcYm5bGVrYs X-Received: by 2002:a17:907:6e8a:b0:731:e3:6da5 with SMTP id sh10-20020a1709076e8a00b0073100e36da5mr12280988ejc.418.1660034410667; Tue, 09 Aug 2022 01:40:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660034410; cv=none; d=google.com; s=arc-20160816; b=UdLM/8jt2Roy3QguwkB9AI1Je3XHPjFKj0F+jFYYssbcn8uhb4tIbUzsjKX6waGmVq fKXurCHRBt7EARTAKSTHX8XfYh3iRCKaKSzjLpqo7vropz9QQRL073lfI/rwWqM8o73J 2UoHsMQ7ydlBe/jwN+Kmqvc4cU+A9up3IJFr85P/0tH2x5l3JG8zgilhfg2Has62gepV 7wJOKyMHJtwXUGTMHZI3pisrqge+kXr+aOWIXxp+Kr6d2ezY9vYdIU6vn5o8H7/DObG1 QV5McZ2rGk1REkVmRyRpGj2YRWg+8WPRNII4ULh2ddHGRe1xYoGTLbuBcSnZ4LZofTyY cEJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=IBxHY7rMJWNEq+B/876Rw/n35o+ISRotZQmrXwHhI+c=; b=bnJAGqNp6rWoKV14C5RszGdfBKAfD+thDO5wPlJeMiAikAYjmOpMrpgqitUknD8YGl 5bT3Aj9EoLQwOKog6q53fTVW30zwLk3In2XB77KpOet+9h55/gRIf9xCnF32WdaUZIjX dI6we6+PO5cf+MHH09ps9wxrXe5X1c/OaAWVwKbTkTqx/Azh8twSir5s2tz47n5Kn+LO 0VgzUZCSWXtywdJMwSK2XEbxzYn4C0z2ZyzCzLuA24px7z4h9zR2s7AAlHzhfOWbISl8 ExDnEb09AmeKWfxl0W+LKTkwzrArJOaj7W/lypZv8+bVzmtZ3QvZJgWd9QH4XanAhZgP 680g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s23-20020a056402037700b0043c158735ddsi6797761edw.109.2022.08.09.01.39.44; Tue, 09 Aug 2022 01:40:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240176AbiHIIcz (ORCPT + 99 others); Tue, 9 Aug 2022 04:32:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239186AbiHIIcv (ORCPT ); Tue, 9 Aug 2022 04:32:51 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19E54205F9 for ; Tue, 9 Aug 2022 01:32:49 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4M25qm4dsvzmVJS; Tue, 9 Aug 2022 16:30:44 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 9 Aug 2022 16:32:47 +0800 Received: from [10.174.177.243] (10.174.177.243) 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, 9 Aug 2022 16:32:47 +0800 Message-ID: Date: Tue, 9 Aug 2022 16:32:46 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v2] mm: add warning if __vm_enough_memory fails Content-Language: en-US To: Andrew Morton , , CC: David Hildenbrand , Yongqiang Liu References: <20220726145428.8030-1-wangkefeng.wang@huawei.com> From: Kefeng Wang In-Reply-To: <20220726145428.8030-1-wangkefeng.wang@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi maintainer, any comments, thanks On 2022/7/26 22: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 > Signed-off-by: Kefeng Wang > --- > 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;