From patchwork Wed Jun 30 07:12:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 12351347 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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 BC7AEC11F65 for ; Wed, 30 Jun 2021 07:14:23 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8095861C75 for ; Wed, 30 Jun 2021 07:14:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8095861C75 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:References:In-Reply-To: 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: List-Owner; bh=CPF2QRU5r/ED7+oUgvGknDWDO6TsWDNVEVxh82JSHcg=; b=mH6ci71a5RmH8h /eZODJkoD8ggV5yGVlJPuaxYoObU8FFL4tRXJOaU+P2sUUQhtb4Jj2HtSM7IMijYVwAl/BrgUqFoI XHlYHdsnufT4DYzViSUNyeqPawjXvd3/1GMKB/8g/HWS16iwxMVMSUVfECAdWQco2OpbNKYhTDGGr j9V61GCyUWM4iLWz8afE3paTQYLv/IMTBu59BjO4EvBNqf5w8wHxWsebTkMjSOuZGAdChOrwGFVoe IGwS4HWb7zH3Y7D/KQM+MWvNm4U6KUKxtMI6Jtae7/FFj9CuKZGN8J9CKOE8dhlVgOry4FvVF4HUp sbPNsQKJJxe4EYfejubg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lyUOf-00D03G-BZ; Wed, 30 Jun 2021 07:12:33 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lyUOT-00Czzo-Em for linux-arm-kernel@lists.infradead.org; Wed, 30 Jun 2021 07:12:22 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id B769161D0D; Wed, 30 Jun 2021 07:12:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625037141; bh=qrNdjflpUvLivu9UtSwHedId14adKJHrYDNOU0/V3Hs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KUqE6XNSw7dk8e2ZILlvfQq1B44GHU4kBesWjirZ6covpZVFA40ua/1O47D6jqxSB iuO138aUwA+rxwY6m0o/pbHv4c8JpG3aY0jES2YDxV5hvX+//xHdMbMWnwwWqShJKM R01ukn142OFPS2qQRvllI/9k5GTkVukP7Mg40e1LHJkrmfnNk9FQoxHby/K8ck19NP CW2W3061j+8wpglgwGYglAj9DAhdB5hjUifUibLsMXrsJTaAy9l77cznRzv5hgFS5t hmLS3L+wmYYXh1XovlmRz8Fvb8cagnxWeEA0/Q4RqhTiTNzLRAS2U6y6J3gc0GR6E6 ZHOo2z4dndf5g== From: Mike Rapoport To: linux-arm-kernel@lists.infradead.org Cc: Andrew Morton , Kefeng Wang , Mike Rapoport , Mike Rapoport , Russell King , Tony Lindgren , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v3 1/4] memblock: free_unused_memmap: use pageblock units instead of MAX_ORDER Date: Wed, 30 Jun 2021 10:12:08 +0300 Message-Id: <20210630071211.21011-2-rppt@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210630071211.21011-1-rppt@kernel.org> References: <20210630071211.21011-1-rppt@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210630_001221_553972_49FF0AF6 X-CRM114-Status: GOOD ( 13.58 ) 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 From: Mike Rapoport The code that frees unused memory map uses rounds start and end of the holes that are freed to MAX_ORDER_NR_PAGES to preserve continuity of the memory map for MAX_ORDER regions. Lots of core memory management functionality relies on homogeneity of the memory map within each pageblock which size may differ from MAX_ORDER in certain configurations. Although currently, for the architectures that use free_unused_memmap(), pageblock_order and MAX_ORDER are equivalent, it is cleaner to have common notation thought mm code. Replace MAX_ORDER_NR_PAGES with pageblock_nr_pages and update the comments to make it more clear why the alignment to pageblock boundaries is required. Signed-off-by: Mike Rapoport --- mm/memblock.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/memblock.c b/mm/memblock.c index afaefa8fc6ab..97fa87541b5f 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -1943,11 +1943,11 @@ static void __init free_unused_memmap(void) start = min(start, ALIGN(prev_end, PAGES_PER_SECTION)); #else /* - * Align down here since the VM subsystem insists that the - * memmap entries are valid from the bank start aligned to - * MAX_ORDER_NR_PAGES. + * Align down here since many operations in VM subsystem + * presume that there are no holes in the memory map inside + * a pageblock */ - start = round_down(start, MAX_ORDER_NR_PAGES); + start = round_down(start, pageblock_nr_pages); #endif /* @@ -1958,11 +1958,11 @@ static void __init free_unused_memmap(void) free_memmap(prev_end, start); /* - * Align up here since the VM subsystem insists that the - * memmap entries are valid from the bank end aligned to - * MAX_ORDER_NR_PAGES. + * Align up here since many operations in VM subsystem + * presume that there are no holes in the memory map inside + * a pageblock */ - prev_end = ALIGN(end, MAX_ORDER_NR_PAGES); + prev_end = ALIGN(end, pageblock_nr_pages); } #ifdef CONFIG_SPARSEMEM