From patchwork Fri Mar 11 18:36:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 12778510 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 AC210C433FE for ; Fri, 11 Mar 2022 18:37:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2E01B8D0007; Fri, 11 Mar 2022 13:37:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 289748D0001; Fri, 11 Mar 2022 13:37:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 12A7F8D0007; Fri, 11 Mar 2022 13:37:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id F2D268D0001 for ; Fri, 11 Mar 2022 13:37:24 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C8ABC2535D for ; Fri, 11 Mar 2022 18:37:24 +0000 (UTC) X-FDA: 79232963208.05.666107F Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by imf07.hostedemail.com (Postfix) with ESMTP id 3049D40022 for ; Fri, 11 Mar 2022 18:37:24 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id D23855C020E; Fri, 11 Mar 2022 13:37:23 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 11 Mar 2022 13:37:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=cc :cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to :reply-to:sender:subject:subject:to:to; s=fm3; bh=e95vsXP8jrOyuF run5UmlX0V2bedBHGJryguMu0faC4=; b=Aeu/f/mie3aIVmoHLJLu/tlQwDCvFY dgFIDrQ3u3efDBP8d1yJFDb6Wr1haN+okgglNFCKK+8il1qJpEGp6UGl+b+lcTw2 ervx3bdd8lJbv4DrVFkSWJO47L/LDySOzOnHgq0eV9CBDkVSWw8bJM/RMzqu9oll M0oM8dGkri/a7XxCG1DWDOJI5PyVI1kciHH63VBf1Njc34RvogGhJv7mydwW7XrQ agENw2xGIEpPewdQaA2Ds10BJrE48guSK1sxkjhmf7ApOzz6KQzK1fK1iK3zeS8V dH0OlB9AOcJtxKhc3U6ltRAJ8LXIBuB7oyW2PhJJYRRbmegYptpOso/w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=e95vsXP8jrOyuFrun5UmlX0V2bedBHGJryguMu0faC4=; b=eGEV6CNW JSiOrcEAknykSvmnNrnSa3nWPACWWOH//RfoelfIROxsGSKlnq3CBKgrPvZ3Zo5G +QqBMgXHULRaClhLpIQEpvDfKUkG2OEYvJ7pafepuqteoDL7TsQtRhduvk7olpAF DalsICTswRSjeKpHBYL/2q69VNsj1HfrI3rXW9h4sIPO2BY2GUBDS54CiLmqjFD9 H8sKXMgoEieYhtWb8EylL1YUxz5hXQenNwHFz7L0tbr8gJvAmYVnLpobkejLQr/t 8FLAaAwwcg12WgXEbKOGlpzuwRLg8pRM8/smlN4zAAK/t+xLw7nWtOX3oyPwmqg6 ZtZeKgSa/MAZ7Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddruddvvddgudduvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhhrggfgsedtqhertdertddtnecuhfhrohhmpegkihcu jggrnhcuoeiiihdrhigrnhesshgvnhhtrdgtohhmqeenucggtffrrghtthgvrhhnpeeije euvdeuudeuhfeghfehieeuvdetvdeugfeigeevteeuieeuhedtgeduheefleenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpeiiihdrhigrnhessh gvnhhtrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 11 Mar 2022 13:37:23 -0500 (EST) From: Zi Yan To: David Hildenbrand , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Vlastimil Babka , Mel Gorman , Eric Ren , Mike Rapoport , Oscar Salvador , Christophe Leroy , Zi Yan Subject: [PATCH v7 4/5] mm: cma: use pageblock_order as the single alignment Date: Fri, 11 Mar 2022 13:36:55 -0500 Message-Id: <20220311183656.1911811-5-zi.yan@sent.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220311183656.1911811-1-zi.yan@sent.com> References: <20220311183656.1911811-1-zi.yan@sent.com> Reply-To: Zi Yan MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3049D40022 X-Stat-Signature: aqc6bameaseer1ocpqteas9fgpoypt4i Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=sent.com header.s=fm3 header.b="Aeu/f/mi"; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=eGEV6CNW; dmarc=pass (policy=none) header.from=sent.com; spf=pass (imf07.hostedemail.com: domain of zi.yan@sent.com designates 66.111.4.28 as permitted sender) smtp.mailfrom=zi.yan@sent.com X-HE-Tag: 1647023844-130491 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: From: Zi Yan Now alloc_contig_range() works at pageblock granularity. Change CMA allocation, which uses alloc_contig_range(), to use pageblock_order alignment. Signed-off-by: Zi Yan --- include/linux/cma.h | 4 ++-- include/linux/mmzone.h | 5 +---- mm/page_alloc.c | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/include/linux/cma.h b/include/linux/cma.h index a6f637342740..63873b93deaa 100644 --- a/include/linux/cma.h +++ b/include/linux/cma.h @@ -17,11 +17,11 @@ #define CMA_MAX_NAME 64 /* - * TODO: once the buddy -- especially pageblock merging and alloc_contig_range() + * the buddy -- especially pageblock merging and alloc_contig_range() * -- can deal with only some pageblocks of a higher-order page being * MIGRATE_CMA, we can use pageblock_nr_pages. */ -#define CMA_MIN_ALIGNMENT_PAGES MAX_ORDER_NR_PAGES +#define CMA_MIN_ALIGNMENT_PAGES pageblock_nr_pages #define CMA_MIN_ALIGNMENT_BYTES (PAGE_SIZE * CMA_MIN_ALIGNMENT_PAGES) struct cma; diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 962b14d403e8..0725c50ca0cb 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -54,10 +54,7 @@ enum migratetype { * * The way to use it is to change migratetype of a range of * pageblocks to MIGRATE_CMA which can be done by - * __free_pageblock_cma() function. What is important though - * is that a range of pageblocks must be aligned to - * MAX_ORDER_NR_PAGES should biggest page be bigger than - * a single pageblock. + * __free_pageblock_cma() function. */ MIGRATE_CMA, #endif diff --git a/mm/page_alloc.c b/mm/page_alloc.c index c2db271b874f..0f96bd57c258 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -9065,8 +9065,8 @@ int __alloc_contig_migrate_range(struct compact_control *cc, * be either of the two. * @gfp_mask: GFP mask to use during compaction * - * The PFN range does not have to be pageblock or MAX_ORDER_NR_PAGES - * aligned. The PFN range must belong to a single zone. + * The PFN range does not have to be pageblock aligned. The PFN range must + * belong to a single zone. * * The first thing this routine does is attempt to MIGRATE_ISOLATE all * pageblocks in the range. Once isolated, the pageblocks should not