From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C4ACC433B4 for ; Thu, 20 May 2021 06:21:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C134161244 for ; Thu, 20 May 2021 06:21:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C134161244 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 276DD6B006C; Thu, 20 May 2021 02:21:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 226EC6B006E; Thu, 20 May 2021 02:21:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C86B6B0070; Thu, 20 May 2021 02:21:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0184.hostedemail.com [216.40.44.184]) by kanga.kvack.org (Postfix) with ESMTP id CA12E6B006C for ; Thu, 20 May 2021 02:21:35 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 61833180F76DC for ; Thu, 20 May 2021 06:21:35 +0000 (UTC) X-FDA: 78160612950.30.C57197B Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf28.hostedemail.com (Postfix) with ESMTP id 9B98620007D8 for ; Thu, 20 May 2021 06:21:32 +0000 (UTC) Received: from dggems703-chm.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Fm01H2PXbz16Q01; Thu, 20 May 2021 14:18:43 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggems703-chm.china.huawei.com (10.3.19.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 20 May 2021 14:21:29 +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.2176.2; Thu, 20 May 2021 14:21:29 +0800 Subject: Re: [PATCH v2 0/3] memblock, arm: fixes for freeing of the memory map To: Mike Rapoport , CC: Andrew Morton , Mike Rapoport , Russell King , , References: <20210519141436.11961-1-rppt@kernel.org> From: Kefeng Wang Message-ID: Date: Thu, 20 May 2021 14:21:29 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20210519141436.11961-1-rppt@kernel.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US 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 Authentication-Results: imf28.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=huawei.com; spf=pass (imf28.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 9B98620007D8 X-Stat-Signature: dxt4onkk8hayxj8d3y6ptnm5qme781fm X-HE-Tag: 1621491692-213117 Content-Transfer-Encoding: quoted-printable 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: On 2021/5/19 22:14, Mike Rapoport wrote: > From: Mike Rapoport >=20 > Hi, >=20 > The coordination between freeing of unused memory map, pfn_valid() and = core > mm assumptions about validity of the memory map in various ranges was n= ot > designed for complex layouts of the physical memory with a lot of holes= all > over the place. >=20 > Kefen Wang reported crashes in move_freepages() on a system with the > following memory layout: >=20 > =C2=A0 node=C2=A0=C2=A0 0: [mem 0x0000000080a00000-0x00000000855fffff] > =C2=A0 node=C2=A0=C2=A0 0: [mem 0x0000000086a00000-0x0000000087dfffff] > =C2=A0 node=C2=A0=C2=A0 0: [mem 0x000000008bd00000-0x000000008c4fffff] > =C2=A0 node=C2=A0=C2=A0 0: [mem 0x000000008e300000-0x000000008ecfffff] > =C2=A0 node=C2=A0=C2=A0 0: [mem 0x0000000090d00000-0x00000000bfffffff] > =C2=A0 node=C2=A0=C2=A0 0: [mem 0x00000000cc000000-0x00000000dc9fffff] > =C2=A0 node=C2=A0=C2=A0 0: [mem 0x00000000de700000-0x00000000de9fffff] > =C2=A0 node=C2=A0=C2=A0 0: [mem 0x00000000e0800000-0x00000000e0bfffff] > =C2=A0 node=C2=A0=C2=A0 0: [mem 0x00000000f4b00000-0x00000000f6ffffff] > =C2=A0 node=C2=A0=C2=A0 0: [mem 0x00000000fda00000-0x00000000ffffefff] >=20 > The crashes can be mitigated by enabling CONFIG_HOLES_IN_ZONE and > essentially turning pfn_valid_within() to pfn_valid() instead of having= it > hardwired to 1. >=20 > Alternatively, we can update ARM's implementation of pfn_valid() to tak= e > into accounting rounding of the freed memory map to pageblock boundarie= s > and make sure it returns true for PFNs that have memory map entries eve= n if > there is no physical memory. >=20 > I can take the entire series via memblock tree. >=20 > @Kefen, I didn't add your Tested-by yet because the patch is slightly > different from the version you've tested. Backport this version(also with link[2]) and oom test could pass too. >=20 > v2: > * Use single memblock_overlaps_region() instead of several > memblock_is_map_memory() lookups. This makes this series depend on upda= te > of MEMBLOCK_NOMAP handling in the memory map [2] >=20 > v1: Link: https://lore.kernel.org/lkml/20210518090613.21519-1-rppt@kern= el.org >=20 > [1] https://lore.kernel.org/lkml/2a1592ad-bc9d-4664-fd19-f7448a37edc0@h= uawei.com > [2] https://lore.kernel.org/lkml/20210511100550.28178-1-rppt@kernel.org >=20 > Mike Rapoport (3): > memblock: free_unused_memmap: use pageblock units instead of MAX_ORD= ER > memblock: align freed memory map on pageblock boundaries with SPARSE= MEM > arm: extend pfn_valid to take into accound freed memory map alignmen= t >=20 > arch/arm/mm/init.c | 13 ++++++++++++- > mm/memblock.c | 23 ++++++++++++----------- > 2 files changed, 24 insertions(+), 12 deletions(-) >=20 >=20 > base-commit: d07f6ca923ea0927a1024dfccafc5b53b61cfecc >=20