From patchwork Mon Dec 13 09:41:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?TWFyay1QSyBUc2FpICjolKHmspvliZsp?= X-Patchwork-Id: 12673493 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38F57C433F5 for ; Mon, 13 Dec 2021 09:42:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B2976B0071; Mon, 13 Dec 2021 04:42:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 962C36B0073; Mon, 13 Dec 2021 04:42:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 851316B0074; Mon, 13 Dec 2021 04:42:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0244.hostedemail.com [216.40.44.244]) by kanga.kvack.org (Postfix) with ESMTP id 759926B0071 for ; Mon, 13 Dec 2021 04:42:02 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 33DE686E98 for ; Mon, 13 Dec 2021 09:41:52 +0000 (UTC) X-FDA: 78912279264.25.BEFED99 Received: from mailgw01.mediatek.com (mailgw01.mediatek.com [216.200.240.184]) by imf15.hostedemail.com (Postfix) with ESMTP id C093EA000C for ; Mon, 13 Dec 2021 09:41:45 +0000 (UTC) X-UUID: 6aeffcebac2542e6829709ffc862bd01-20211213 X-UUID: 6aeffcebac2542e6829709ffc862bd01-20211213 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1631742106; Mon, 13 Dec 2021 02:41:42 -0700 Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 13 Dec 2021 01:41:41 -0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 13 Dec 2021 17:41:39 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 13 Dec 2021 17:41:39 +0800 From: Mark-PK Tsai To: CC: , , , , , , , , , , Subject: [PATCH 5.10 0/5] memblock, arm: fixes for freeing of the memory map Date: Mon, 13 Dec 2021 17:41:30 +0800 Message-ID: <20211213094135.1798-1-mark-pk.tsai@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N X-Rspamd-Queue-Id: C093EA000C Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of mark-pk.tsai@mediatek.com designates 216.200.240.184 as permitted sender) smtp.mailfrom=mark-pk.tsai@mediatek.com; dmarc=pass (policy=none) header.from=mediatek.com X-Rspamd-Server: rspam04 X-Stat-Signature: 1xceeaxt8kn5rfp48k1cmcs8aiksdanb X-HE-Tag: 1639388505-685327 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: When linux memory is not aligned with page block size and have hole in zone, the 5.4-lts arm kernel might crash in move_freepages() as Kefen Wang reported in [1]. Backport the upstream fix commits by Mike Rapoport [2] to 5.4 can fix this issue. And free_unused_memmap() of arm and arm64 are moved to generic mm/memblock in the below upstream commit, so I applied the first two patches to free_unused_memmap() in arch/arm/mm/init.c. (4f5b0c178996 arm, arm64: move free_unused_memmap() to generic mm) [1] https://lore.kernel.org/lkml/2a1592ad-bc9d-4664-fd19-f7448a37edc0@huawei.com/ [2] https://lore.kernel.org/lkml/20210630071211.21011-1-rppt@kernel.org/#t Mike Rapoport (5): memblock: free_unused_memmap: use pageblock units instead of MAX_ORDER memblock: align freed memory map on pageblock boundaries with SPARSEMEM memblock: ensure there is no overflow in memblock_overlaps_region() arm: extend pfn_valid to take into account freed memory map alignment arm: ioremap: don't abuse pfn_valid() to check if pfn is in RAM arch/arm/mm/init.c | 37 +++++++++++++++++++++++++------------ arch/arm/mm/ioremap.c | 4 +++- mm/memblock.c | 3 ++- 3 files changed, 30 insertions(+), 14 deletions(-)