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: 12695843 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82E00C433F5 for ; Mon, 13 Dec 2021 09:13:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=DmM2Zr+b9Bneo/SJo6pRON4aULh1AvwIeiZMcT4XF6o=; b=vW4wzxHHfjEocb ko52Hb4SzEZbkerVsRzeVJNuUHCHScUfJIUj21LiWVl1ZbQIMUYUejnsk0G0BvhsE5LS52YdKgrMd ueEviXg/EfPJUKznaN46Cn6K4aau/Oa9zhRhgJwxXJaP8SKcvLiUCIY5MIdTUndAWULpdd6Y4Hw2G 7RI920rGFrC+7jPxx0Gpg/GmgSXkwGe+jMFbTlGGfH+mnup06hZs6zBYm3/3mMDO3iTvS67XD+Uju f4AbuI0RLx8DICJLlDEeSfGb/0Oatn3VTJ0H1GnWJOxSGuz1cwei1ihYuNe7Z0C2qqIp5aEuDUeKX z01ITVt4RFTKMm/AICMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwhNH-008Xhh-9K; Mon, 13 Dec 2021 09:11:59 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwhIm-008VsZ-C3 for linux-arm-kernel@lists.infradead.org; Mon, 13 Dec 2021 09:07:23 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211213_010720_465850_946E7278 X-CRM114-Status: UNSURE ( 9.01 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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(-)