From patchwork Fri Mar 20 05:58:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaewon Kim X-Patchwork-Id: 11448443 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1EC89139A for ; Fri, 20 Mar 2020 05:58:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D19CA2072D for ; Fri, 20 Mar 2020 05:58:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="L4+m/N1v" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D19CA2072D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 86CE36B0006; Fri, 20 Mar 2020 01:58:46 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 845586B000A; Fri, 20 Mar 2020 01:58:46 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CA9B6B0006; Fri, 20 Mar 2020 01:58:46 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 528CE6B0006 for ; Fri, 20 Mar 2020 01:58:46 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 6F2F7180AD804 for ; Fri, 20 Mar 2020 05:58:46 +0000 (UTC) X-FDA: 76614686652.26.air10_86a8578275933 X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,jaewon31.kim@samsung.com,,RULES_HIT:30003:30012:30054:30070:30075,0,RBL:203.254.224.25:@samsung.com:.lbl8.mailshell.net-62.18.1.2 64.10.201.10,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: air10_86a8578275933 X-Filterd-Recvd-Size: 8728 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Fri, 20 Mar 2020 05:58:45 +0000 (UTC) Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20200320055841epoutp02ec23b1239f74b6426a04300a69134c3b~97aF2GSIA2572025720epoutp02k for ; Fri, 20 Mar 2020 05:58:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20200320055841epoutp02ec23b1239f74b6426a04300a69134c3b~97aF2GSIA2572025720epoutp02k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1584683921; bh=vah53AmqrEMXcmGdds4iFjJJZRZ1yBycMR96OdrQFss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L4+m/N1vLPPC/y3sKbGxeqEMB0d1Q86rQHfsAquA+ZiD8VciwTHiEiv8Jj7upa5fr HANwwu1l5eO6wu/U27daB1opvPbOBRNqqdbMpvaM8ioSkpH2xeCLiDsWBQoPcpNNHz HFQYRg+mxCWpPwsjJwI7q4AMiksxsze18qhobZis= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20200320055841epcas1p1e455875e4fed5952153773fb70cfa5c2~97aFfrhUK3072430724epcas1p1N; Fri, 20 Mar 2020 05:58:41 +0000 (GMT) Received: from epsmges1p1.samsung.com (unknown [182.195.40.160]) by epsnrtp3.localdomain (Postfix) with ESMTP id 48kCkl6kSqzMqYkc; Fri, 20 Mar 2020 05:58:39 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id 92.55.04145.F8B547E5; Fri, 20 Mar 2020 14:58:39 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200320055839epcas1p1a9b626b3afe8c22e36ff198f9eaeab2e~97aDnirGr3070730707epcas1p1L; Fri, 20 Mar 2020 05:58:39 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200320055839epsmtrp144ccc173c9c0336c189ed392df040879~97aDlv-in2644226442epsmtrp1F; Fri, 20 Mar 2020 05:58:39 +0000 (GMT) X-AuditID: b6c32a35-2a5ff70000001031-64-5e745b8f6b73 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id F7.84.04024.F8B547E5; Fri, 20 Mar 2020 14:58:39 +0900 (KST) Received: from jaewon-linux.10.32.193.11 (unknown [10.253.104.82]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200320055839epsmtip16e07cca32822231a709d802fc0c31507~97aDaK3rs1022810228epsmtip1P; Fri, 20 Mar 2020 05:58:39 +0000 (GMT) From: Jaewon Kim To: willy@infradead.org, walken@google.com, bp@suse.de, akpm@linux-foundation.org, srostedt@vmware.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, jaewon31.kim@gmail.com, Jaewon Kim Subject: [PATCH v3 1/2] mmap: remove inline of vm_unmapped_area Date: Fri, 20 Mar 2020 14:58:22 +0900 Message-Id: <20200320055823.27089-2-jaewon31.kim@samsung.com> X-Mailer: git-send-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Xz3n7 kgvfvdfgBq7DtP7NExvenH/DWNf25eRoqjZ90b7NRdvmLPZWtA3nehakmh+u3vk1TmMauN1J SHgLQ2rFTp75A1U37nWYAwAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNLMWRmVeSWpSXmKPExsWy7bCSnG5/dEmcwdpfbBZz1q9hs5jYr2nR vXkmo0Xv+1dMFpd3zWGzuLfmP6vF0V8vWSz+Taq1+P1jDpsDp8fOWXfZPRZsKvXYvELLY9On SeweJ2b8ZvHo27KK0WPz6WqPz5vkPN7Nf8sWwBnFZZOSmpNZllqkb5fAlTFjyQ22gtMSFRvW tzE1MK4T6WLk5JAQMJH4+eEsaxcjF4eQwG5GiTctD1ghEjISb84/Zeli5ACyhSUOHy6GqPnK KHH701FGkBo2AW2J9wsmgdWLCORJtGx6CGYzC1RK/Lt9C8wWFrCXuHzkFlg9i4CqxKmpy1lA bF4BW4mpf+4zQcyXl1j4nxkkzClgJ3F9zyk2EFsIqGTuxGfMExj5FjAyrGKUTC0ozk3PLTYs MMxLLdcrTswtLs1L10vOz93ECA5SLc0djJeXxB9iFOBgVOLhndFWHCfEmlhWXJl7iFGCg1lJ hFc3HSjEm5JYWZValB9fVJqTWnyIUZqDRUmc92nesUghgfTEktTs1NSC1CKYLBMHp1QDI9tr N/st2yRn1L/KONy+MmtLT8/chRIBLo7T3stmG/nEB/8UMxc+dVbZ8wiXVe2h7Fz5zb/j1kR5 OK2TsdNsrTi54cTaKa+5rr97LvP9xNpbixSkIpW7pLl9X76/E30l33qW5P3TeRv6Nvxtc1kj ceSGKWOZhw0Tc9Xt67UrHwp/FztlUqn2U4mlOCPRUIu5qDgRAJfgYv1OAgAA X-CMS-MailID: 20200320055839epcas1p1a9b626b3afe8c22e36ff198f9eaeab2e X-Msg-Generator: CA X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20200320055839epcas1p1a9b626b3afe8c22e36ff198f9eaeab2e References: <20200320055823.27089-1-jaewon31.kim@samsung.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: In prepration for next patch remove inline of vm_unmapped_area and move code to mmap.c. There is no logical change. Also remove unmapped_area[_topdown] out of mm.h, there is no code calling to them. Signed-off-by: Jaewon Kim Reviewed-by: Vlastimil Babka --- v3: add static keyword v2: remove inline and move code to mmap.c --- include/linux/mm.h | 21 +-------------------- mm/mmap.c | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index c54fb96cb1e6..f4263993d053 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2364,26 +2364,7 @@ struct vm_unmapped_area_info { unsigned long align_offset; }; -extern unsigned long unmapped_area(struct vm_unmapped_area_info *info); -extern unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info); - -/* - * Search for an unmapped address range. - * - * We are looking for a range that: - * - does not intersect with any VMA; - * - is contained within the [low_limit, high_limit) interval; - * - is at least the desired size. - * - satisfies (begin_addr & align_mask) == (align_offset & align_mask) - */ -static inline unsigned long -vm_unmapped_area(struct vm_unmapped_area_info *info) -{ - if (info->flags & VM_UNMAPPED_AREA_TOPDOWN) - return unmapped_area_topdown(info); - else - return unmapped_area(info); -} +extern unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info); /* truncate.c */ extern void truncate_inode_pages(struct address_space *, loff_t); diff --git a/mm/mmap.c b/mm/mmap.c index d681a20eb4ea..ba990c20ecc2 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1848,7 +1848,7 @@ unsigned long mmap_region(struct file *file, unsigned long addr, return error; } -unsigned long unmapped_area(struct vm_unmapped_area_info *info) +static unsigned long unmapped_area(struct vm_unmapped_area_info *info) { /* * We implement the search by looking for an rbtree node that @@ -1951,7 +1951,7 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info) return gap_start; } -unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) +static unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) { struct mm_struct *mm = current->mm; struct vm_area_struct *vma; @@ -2050,6 +2050,22 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) return gap_end; } +/* + * Search for an unmapped address range. + * + * We are looking for a range that: + * - does not intersect with any VMA; + * - is contained within the [low_limit, high_limit) interval; + * - is at least the desired size. + * - satisfies (begin_addr & align_mask) == (align_offset & align_mask) + */ +unsigned long vm_unmapped_area(struct vm_unmapped_area_info *info) +{ + if (info->flags & VM_UNMAPPED_AREA_TOPDOWN) + return unmapped_area_topdown(info); + else + return unmapped_area(info); +} #ifndef arch_get_mmap_end #define arch_get_mmap_end(addr) (TASK_SIZE) From patchwork Fri Mar 20 05:58:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaewon Kim X-Patchwork-Id: 11448441 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 639D11668 for ; Fri, 20 Mar 2020 05:58:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1CAA320772 for ; Fri, 20 Mar 2020 05:58:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="qjSniMvr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1CAA320772 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 202D26B0003; Fri, 20 Mar 2020 01:58:46 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1B2DB6B0006; Fri, 20 Mar 2020 01:58:46 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C97C6B0007; Fri, 20 Mar 2020 01:58:46 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0232.hostedemail.com [216.40.44.232]) by kanga.kvack.org (Postfix) with ESMTP id EA42B6B0003 for ; Fri, 20 Mar 2020 01:58:45 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 17FF58248076 for ; Fri, 20 Mar 2020 05:58:46 +0000 (UTC) X-FDA: 76614686652.11.toad37_869b3f07c0807 X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,jaewon31.kim@samsung.com,,RULES_HIT:30012:30054:30075,0,RBL:203.254.224.25:@samsung.com:.lbl8.mailshell.net-64.10.201.10 62.18.1.2,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: toad37_869b3f07c0807 X-Filterd-Recvd-Size: 9379 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Fri, 20 Mar 2020 05:58:44 +0000 (UTC) Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20200320055841epoutp02455dd7ef9ada3dae42e563d55fe72a0e~97aFr25V32572025720epoutp02j for ; Fri, 20 Mar 2020 05:58:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20200320055841epoutp02455dd7ef9ada3dae42e563d55fe72a0e~97aFr25V32572025720epoutp02j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1584683921; bh=JLXzpDo2Uz5P4xcCLc3T6nk7O094GGMnndhBijC6c60=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qjSniMvrQi9E6CrAZoY/KWmrEBPTDj078IDqBn/My8IG+488uyk2g1Ch1RLCUGPgv Lo8JPCEejcACRP/zAsoU1gI5kxd8HUyI+gvx8GKLNo1LvapLo7b4Z10tb/WB4icb52 Lt22LOx5U1dteU9+hRVYtbOEGQQvGCIJglsvTciw= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20200320055841epcas1p24fde7418e65b52d116358225715ecc75~97aFdKznn0986109861epcas1p2N; Fri, 20 Mar 2020 05:58:41 +0000 (GMT) Received: from epsmges1p3.samsung.com (unknown [182.195.40.166]) by epsnrtp2.localdomain (Postfix) with ESMTP id 48kCkm1mJzzMqYkV; Fri, 20 Mar 2020 05:58:40 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p3.samsung.com (Symantec Messaging Gateway) with SMTP id 64.00.04071.09B547E5; Fri, 20 Mar 2020 14:58:40 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200320055839epcas1p189100549687530619d8a19919e8b5de0~97aDoCUx93235132351epcas1p1k; Fri, 20 Mar 2020 05:58:39 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200320055839epsmtrp23f33547d37fa3bf441efe7c22e14ea4b~97aDmu8c80413504135epsmtrp2y; Fri, 20 Mar 2020 05:58:39 +0000 (GMT) X-AuditID: b6c32a37-797ff70000000fe7-81-5e745b901180 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 84.06.04158.F8B547E5; Fri, 20 Mar 2020 14:58:39 +0900 (KST) Received: from jaewon-linux.10.32.193.11 (unknown [10.253.104.82]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200320055839epsmtip136b85553e8d717235870d503d3b4d8bf~97aDc9S7t1022410224epsmtip1P; Fri, 20 Mar 2020 05:58:39 +0000 (GMT) From: Jaewon Kim To: willy@infradead.org, walken@google.com, bp@suse.de, akpm@linux-foundation.org, srostedt@vmware.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, jaewon31.kim@gmail.com, Jaewon Kim Subject: [PATCH v3 2/2] mm: mmap: add trace point of vm_unmapped_area Date: Fri, 20 Mar 2020 14:58:23 +0900 Message-Id: <20200320055823.27089-3-jaewon31.kim@samsung.com> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20200320055823.27089-1-jaewon31.kim@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA01Sa0hTYRjm82zHs3JxWLeXkZcOJKmZO63pSaYU3Q7lD6P6U+Q6uMM2PLu0 s5l2oZsMWVnOWGV4zeiGYUyLlIoywsgoRcooKqOItOYqs5uZbZ5F/Xve53senof3ewlMdQBX Exabi3faOIHCp8iu3E7JSK/c7CrQdJ+PY2pamnHGdySFOdhajZiK0FAM09dRgzMvmifkzJ2f gzLmd9VuZux7Db5UwbaffB7LNgTcbOu5VDbwuSqWvXtiTMYebruA2NbunexIIIEdrg/i+YpN gt7Mc0bemcTbCu1Gi82UQ61db1hu0GVq6HR6CZNFJdk4K59DrcjLT19lEcL9qKRiTnCHqXxO FKmMXL3T7nbxSWa76MqheIdRcNAax0KRs4pum2lhod2aTWs0i3Rh5VbB/PpFl8zRE19y700I 34tC4EUKAsjFULP/CfKiKYSKvIqgr/aITBo+I/jUNS6LqFTkVwQX/Wl/HY/qH0b56wjqfImS 4RuCU1cq8cgDTqZBqKFKHsEzSDP4f76c5DHSDcEPd7EInk6uhHf9HZMaGTkP6kLvUQQryRwY uH80xouIcFg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oifPK5x+LFBJITyxJzU5NLUgtgskycXBKNTCqWfVE 3ipUj1kTUPMzU9nKvTh1p7TY07eXA03/fRfXbL8ooZHT0fnRb0nVhWDNH7PSdzzauKD2SFz4 9wv/LNbVb6pp2Fh2eaG0uHveSuVPMuUvPyvt/XE5kKtCpHvGnrj2vScPCs7u/WOn/OloklyM T9Oavfp3c5261+VVuzxVVf/X3TfHO02JpTgj0VCLuag4EQAVXKm9TQIAAA== X-CMS-MailID: 20200320055839epcas1p189100549687530619d8a19919e8b5de0 X-Msg-Generator: CA X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20200320055839epcas1p189100549687530619d8a19919e8b5de0 References: <20200320055823.27089-1-jaewon31.kim@samsung.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. In my platform, GPU driver calls to vm_unmapped_area and the driver returns -ENOMEM even in GPU side shortage. It can be hard to distinguish which code layer returns the -ENOMEM. Create mmap trace file and add trace point of vm_unmapped_area. i.e.) 277.156599: vm_unmapped_area: addr=77e0d03000 err=0 total_vm=0x17014b flags=0x1 len=0x400000 lo=0x8000 hi=0x7878c27000 mask=0x0 ofs=0x1 342.838740: vm_unmapped_area: addr=0 err=-12 total_vm=0xffb08 flags=0x0 len=0x100000 lo=0x40000000 hi=0xfffff000 mask=0x0 ofs=0x22 Signed-off-by: Jaewon Kim --- v3: reduce fast_assign and print format v2: use trace point rather than printk with ratelimit v1: use printk with ratelimit --- include/trace/events/mmap.h | 48 +++++++++++++++++++++++++++++++++++++++++++++ mm/mmap.c | 12 ++++++++++-- 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 include/trace/events/mmap.h diff --git a/include/trace/events/mmap.h b/include/trace/events/mmap.h new file mode 100644 index 000000000000..986a41b6cfa9 --- /dev/null +++ b/include/trace/events/mmap.h @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM mmap + +#if !defined(_TRACE_MMAP_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_MMAP_H + +#include + +TRACE_EVENT(vm_unmapped_area, + + TP_PROTO(unsigned long addr, struct vm_unmapped_area_info *info), + + TP_ARGS(addr, info), + + TP_STRUCT__entry( + __field(unsigned long, addr) + __field(unsigned long, total_vm) + __field(unsigned long, flags) + __field(unsigned long, length) + __field(unsigned long, low_limit) + __field(unsigned long, high_limit) + __field(unsigned long, align_mask) + __field(unsigned long, align_offset) + ), + + TP_fast_assign( + __entry->addr = addr; + __entry->total_vm = current->mm->total_vm; + __entry->flags = info->flags; + __entry->length = info->length; + __entry->low_limit = info->low_limit; + __entry->high_limit = info->high_limit; + __entry->align_mask = info->align_mask; + __entry->align_offset = info->align_offset; + ), + + TP_printk("addr=%lx err=%ld total_vm=0x%lx flags=0x%lx len=0x%lx lo=0x%lx hi=0x%lx mask=0x%lx ofs=0x%lx\n", + IS_ERR_VALUE(__entry->addr) ? 0 : __entry->addr, + IS_ERR_VALUE(__entry->addr) ? __entry->addr : 0, + __entry->total_vm, __entry->flags, __entry->length, + __entry->low_limit, __entry->high_limit, __entry->align_mask, + __entry->align_offset) +); +#endif + +/* This part must be outside protection */ +#include diff --git a/mm/mmap.c b/mm/mmap.c index ba990c20ecc2..94ae18398c59 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -53,6 +53,9 @@ #include #include +#define CREATE_TRACE_POINTS +#include + #include "internal.h" #ifndef arch_mmap_check @@ -2061,10 +2064,15 @@ static unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) */ 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); + + trace_vm_unmapped_area(addr, info); + return addr; } #ifndef arch_get_mmap_end