Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4056958ybf; Tue, 3 Mar 2020 19:03:06 -0800 (PST) X-Google-Smtp-Source: ADFU+vsv3mR/j81TEQGVPNo542h5s8PeS6o1qijE1Bp3vkfCLGwoL/uDrN7TlS5DZ+0bTLePb7qc X-Received: by 2002:a05:6830:1481:: with SMTP id s1mr792468otq.44.1583290986297; Tue, 03 Mar 2020 19:03:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583290986; cv=none; d=google.com; s=arc-20160816; b=N4UdOUDYZ1jYPang/gJuG3RbT+iqt5jHs1w0xm6IYMHa+HNeq4JXGBuuoY4i3Him4b TkYWzg2BrbTMjfv4xRnqUWHNdDipm2rC/O4OxXvS8SQuAxFzwAQF9aC0vrpGIzVIlTKy tdeRMcO6kGY3sUKrpOwYfnZxxix30AT+kllKaxcy2i7Qew4xqFo1gbclb3nPLI1UTDPD 4vVcqAbZM8Bbp+bMkhmT8j8dOtPiecBV1m/2ZrRfUWepWlucXkeCWGo5uZB2WUAlAOqg gbrelXRTQMhHdd4sh8wUQ81CVD2Ik6mYqGvH5r+Zy/iPA5YYAnuPZ/iyC4gazjCmSHWU cCbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter; bh=JDd1T3+YRNjJK3bE+SzL+8P0+FiGsioR6Jes5f4jxJQ=; b=Bv4bYTR/K9aOyXWxkHqUtc4whQ2KpstkTVUjyAH03g2PCiU3vW8EWiu2/KbYldi24C NgMyGqLLWsIfoIQCFX6ONXlC/qtC6vLuQ+O9pm3d0nSom7pGwuCkmp6W5VXGT5VUCJtd bJ4+YSa6bRI+q6eS2ds7PG6SKokuH9gj42lCTk0UH4vc4lgpt+jjtZ92AfNeJDnIwD2N M7IkARrVe4sYgSuJQOPeMCTiDe9++qF7adwyXpcP8O0m7dWqzxyiLIvBqxG4DpamHvjj gOIodq/5xrME307bAdGIMYtv+w/BL1V1DpJ2HLSq/Rfkfp+ZagmXFVUZWwWReqYy+yd7 rnfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=qiI2jCOU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i20si346802ota.82.2020.03.03.19.02.54; Tue, 03 Mar 2020 19:03:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=qiI2jCOU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387736AbgCDDCQ (ORCPT + 99 others); Tue, 3 Mar 2020 22:02:16 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:30647 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387580AbgCDDCQ (ORCPT ); Tue, 3 Mar 2020 22:02:16 -0500 Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20200304030213epoutp01068d113ea84851b19178d9c12f8139b8~4_rcwxtKI2083320833epoutp01Z for ; Wed, 4 Mar 2020 03:02:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20200304030213epoutp01068d113ea84851b19178d9c12f8139b8~4_rcwxtKI2083320833epoutp01Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1583290933; bh=JDd1T3+YRNjJK3bE+SzL+8P0+FiGsioR6Jes5f4jxJQ=; h=From:To:Cc:Subject:Date:References:From; b=qiI2jCOUGkCCeSj5pdIcSEAxacA5/qsnhvYsVQyr0b+DVQx8UOAutMXghIfxhmSQg I0C/z+LIGUKpfuQ+oWUJrhLnOqPPRq3RqsW5lMKciqvr6JnpDNleEWpr+jw+RTwNam g8Ew+HINsav7OrWzgqo+KUTw5uxvxQcXpfXyv+VY= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20200304030213epcas1p3f5c5ed37098a9e9573462f17b65f24be~4_rcUfaw42641626416epcas1p3z; Wed, 4 Mar 2020 03:02:13 +0000 (GMT) Received: from epsmges1p5.samsung.com (unknown [182.195.40.166]) by epsnrtp1.localdomain (Postfix) with ESMTP id 48XJZX1wrjzMqYlm; Wed, 4 Mar 2020 03:02:12 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id 28.44.51241.43A1F5E5; Wed, 4 Mar 2020 12:02:12 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p4.samsung.com (KnoxPortal) with ESMTPA id 20200304030211epcas1p4da8cb569947aefb3aad1da039aaabce4~4_ra-2t-42787927879epcas1p4Q; Wed, 4 Mar 2020 03:02:11 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200304030211epsmtrp1253ac05cdbf978b91bbac385255f5416~4_ra-IcEq1810618106epsmtrp1N; Wed, 4 Mar 2020 03:02:11 +0000 (GMT) X-AuditID: b6c32a39-14bff7000001c829-1f-5e5f1a3470d0 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 71.6D.06569.33A1F5E5; Wed, 4 Mar 2020 12:02:11 +0900 (KST) Received: from jaewon-linux.10.32.193.11 (unknown [10.253.104.82]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200304030211epsmtip1a9bd437bc0c024e1aa416e475bd3fa93~4_ra0Rda12234322343epsmtip1C; Wed, 4 Mar 2020 03:02:11 +0000 (GMT) From: Jaewon Kim To: walken@google.com, bp@suse.de, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, jaewon31.kim@gmail.com, Jaewon Kim Subject: [PATCH] mm: mmap: show vm_unmapped_area error log Date: Wed, 4 Mar 2020 12:02:06 +0900 Message-Id: <20200304030206.1706-1-jaewon31.kim@samsung.com> X-Mailer: git-send-email 2.13.7 X-Brightmail-Tracker: H4sIAAAAAAAAA02SbUhTURjHObvb3dW6dZlWp1FmlwpmqZtzdo3NoixWmRgWkZDrsh028e6F 3S0yCQTFajkroTDJMI0Ks4ytZBp9aFKaVkRSX3yhJghpKqx3JO1u16hvv+c5//95/jznEJgi IlMSZQ4PcjtYjsYTpV29KnV6ttJUqn7QuJS51tmBM5cuqJjzwauA8c9OSpihnms4M9axIGPm G07vkBu7m0blxpaA1xiINsiN/Y1zUmP9w3ZgDA5WGr8EUorkJZzehlgLcqcih9lpKXNYDfT+ YtMuky5HrUnX5DJb6VQHa0cGOr+gKH1PGSeEoVNPsJxXaBWxPE9n5undTq8HpdqcvMdAI5eF c2nUrgyetfNehzXD7LRv06jVWTpBeZyztQ6+lbjukCfHXoQkVcC3xAcSCEhlwyt326QxVlAh AEcGeB9IFDgK4KOFxzKx+A7g9egr2V/H98gMLjqeAFj9Zaco+gHg6/F38tgBTm2Gsy0NcUMy pYfDjffijFFeOP25H4txErUNno1E46Ol1Eb4pjos9AmCFPRnhvEYQmodvLGAxa6HVB0Oxya/ YmKGfNg368dFToKTfQ/lIivhpwu1ctFQDeD01SAQixoARwN+IK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FuvlHiPoOaGvvIRVd9jU+63pp+LTKZZUvO H3m9iSpnVIInixTfzIv7ofmUh51Jx6v566IphTOWuDmxrWW/9f6bEktxRqKhFnNRcSIAJx3Z aiECAAA= X-CMS-MailID: 20200304030211epcas1p4da8cb569947aefb3aad1da039aaabce4 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20200304030211epcas1p4da8cb569947aefb3aad1da039aaabce4 References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Even on 64 bit kernel, the mmap failure can happen for a 32 bit task. Virtual memory space shortage of a task on mmap is reported to userspace as -ENOMEM. It can be confused as physical memory shortage of overall system. The vm_unmapped_area can be called to by some drivers or other kernel core system like filesystem. It can be hard to know which code layer returns the -ENOMEM. Print error log of vm_unmapped_area with rate limited. Without rate limited, soft lockup ocurrs on infinite mmap sytem call. i.e.) <3>[ 576.024088] [6: mmap_infinite:14251] mmap: vm_unmapped_area err:-12 total_vm:0xfee08 flags:0x1 len:0xa00000 low:0x8000 high:0xf3f63000 Signed-off-by: Jaewon Kim --- include/linux/mm.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 52269e56c514..ee822d65ebb7 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2379,10 +2379,19 @@ extern unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info); static inline unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info) { + unsigned long addr; + if (info->flags & VM_UNMAPPED_AREA_TOPDOWN) - return unmapped_area_topdown(info); + addr = unmapped_area_topdown(info); else - return unmapped_area(info); + addr = unmapped_area(info); + + if (IS_ERR_VALUE(addr) && printk_ratelimit()) { + pr_err("%s err:%d total_vm:0x%lx flags:0x%lx len:0x%lx low:0x%lx high:0x%lx\n", + __func__, addr, current->mm->total_vm, info->flags, + info->length, info->low_limit, info->high_limit); + } + return addr; } /* truncate.c */ -- 2.13.7