From patchwork Mon Dec 13 08:57:05 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: 12673417 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 81D7BC433F5 for ; Mon, 13 Dec 2021 09:08:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4AA746B0073; Mon, 13 Dec 2021 04:07:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4326B6B0074; Mon, 13 Dec 2021 04:07:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2FA9C6B007B; Mon, 13 Dec 2021 04:07:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0237.hostedemail.com [216.40.44.237]) by kanga.kvack.org (Postfix) with ESMTP id 1D53C6B0073 for ; Mon, 13 Dec 2021 04:07:36 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id D25C986E70 for ; Mon, 13 Dec 2021 09:07:25 +0000 (UTC) X-FDA: 78912192450.18.89DDE3C Received: from mailgw01.mediatek.com (mailgw01.mediatek.com [216.200.240.184]) by imf02.hostedemail.com (Postfix) with ESMTP id BBC8480003 for ; Mon, 13 Dec 2021 09:07:23 +0000 (UTC) X-UUID: 0982ab0906b247c69e2503ded7fbeb32-20211213 X-UUID: 0982ab0906b247c69e2503ded7fbeb32-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 1267777246; Mon, 13 Dec 2021 02:07:16 -0700 Received: from mtkexhb01.mediatek.inc (172.21.101.102) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 13 Dec 2021 00:57:14 -0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkexhb01.mediatek.inc (172.21.101.102) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 13 Dec 2021 16:57:12 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 13 Dec 2021 16:57:12 +0800 From: Mark-PK Tsai To: CC: , , , , , , , , , , Subject: [PATCH 5.4 0/5] memblock, arm: fixes for freeing of the memory map Date: Mon, 13 Dec 2021 16:57:05 +0800 Message-ID: <20211213085710.28962-1-mark-pk.tsai@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N X-Stat-Signature: iefxexge4agq4ztkz4i3r9ghzzs7r6ef Authentication-Results: imf02.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=mediatek.com; spf=pass (imf02.hostedemail.com: domain of mark-pk.tsai@mediatek.com designates 216.200.240.184 as permitted sender) smtp.mailfrom=mark-pk.tsai@mediatek.com X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: BBC8480003 X-HE-Tag: 1639386443-139880 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(-)