From patchwork Mon Apr 25 14:31:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 12825849 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 566DAC4332F for ; Mon, 25 Apr 2022 14:31:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5533F6B0078; Mon, 25 Apr 2022 10:31:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 463226B0082; Mon, 25 Apr 2022 10:31:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C6EF76B0078; Mon, 25 Apr 2022 10:31:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 932826B0078 for ; Mon, 25 Apr 2022 10:31:33 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id C5EA727E08 for ; Mon, 25 Apr 2022 14:31:32 +0000 (UTC) X-FDA: 79395639624.14.EB6A9F6 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by imf29.hostedemail.com (Postfix) with ESMTP id 0D83412003D for ; Mon, 25 Apr 2022 14:31:29 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id DE5505C015E; Mon, 25 Apr 2022 10:31:31 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 25 Apr 2022 10:31:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=cc :cc:content-transfer-encoding:content-type: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=fm1; t= 1650897091; x=1650983491; bh=JX3ps6oeKyuY4MRNJ2GnR5dfK9tpHY2lYtV KJFK+Xqk=; b=TDLUN33aq/3MMOOBQQuus8Fk/UJeHWVmjSrGGfM1mfa8bAK7vJ5 wBgjeOJBfDbCb1I+PWErV8urwm1X8HsvklEN2dNwEBFu94cLiujXIAvbXoffx4gk l2kjZo7ki3kbSZyrX5cNTWKwN64199owIRtTiDNJgbbg8OHol/1LlxZuobIz0GVg InGz1TautCYF+GhvEtdFDS4AkX0OenV93TdDt+1GDmoLvymu8FlJ6s+1hBmj+Mkk SZar04DgOqU5FQqIekQsE4D+SpcP3Mg2/7TC2gu6nKcBytgL90mZ/VmMEprwPZ7U shukvJcGtjcIIeMfMU5hz29FVM+3qGS/iew== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type: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=fm1; t=1650897091; x=1650983491; bh=J X3ps6oeKyuY4MRNJ2GnR5dfK9tpHY2lYtVKJFK+Xqk=; b=kPGxsDlj958gfs7of XLw5DbJmBrF786oXF8yS51MeyrHP/OkunAM2eAuyNQdZi0QGdoccKuDxO1XUYst8 yiFIaBmFTDJ7CWWYlvSwpqV9LLqzLRcXPmnXmFk5ZaBjX1kiCHnT/nE6xylRvB+j lT+TQJnJ3Y9RGorphVoO7+m056go8ZZopyTT2x7vMqUeNb5Z0C2yyRiep1NW0t1v VqqTDedauWXYj1AsuuOJNYVa2NZDx/MF2dpkqgz0/cdLt52NSLD2OPWd0sjE4xMX I0KJdFXQD/ThxZwdIYcZPbxwittjpaGNQi/XUJtLaQ68tM/UAUUvv/sZi1WwMNE5 a++TA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedruddugdejhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffojghfrhggtgfgsehtqhertdertdejnecuhfhrohhmpegkihcu jggrnhcuoeiiihdrhigrnhesshgvnhhtrdgtohhmqeenucggtffrrghtthgvrhhnpeevhe evleehgfduhffhudefteehhfegjeeiudevheevffetuedttdfhkeeuleehudenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpeiiihdrhigrnhessh gvnhhtrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 25 Apr 2022 10:31:31 -0400 (EDT) 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 , Andrew Morton , Zi Yan Subject: [PATCH v11 5/6] mm: cma: use pageblock_order as the single alignment Date: Mon, 25 Apr 2022 10:31:17 -0400 Message-Id: <20220425143118.2850746-6-zi.yan@sent.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220425143118.2850746-1-zi.yan@sent.com> References: <20220425143118.2850746-1-zi.yan@sent.com> Reply-To: Zi Yan MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 0D83412003D X-Stat-Signature: w333xu84er3nebgqwyqgr5sqy78dgcjr X-Rspam-User: Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=sent.com header.s=fm1 header.b=TDLUN33a; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=kPGxsDlj; spf=pass (imf29.hostedemail.com: domain of zi.yan@sent.com designates 66.111.4.27 as permitted sender) smtp.mailfrom=zi.yan@sent.com; dmarc=pass (policy=none) header.from=sent.com X-HE-Tag: 1650897089-11238 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_nr_pages 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 46ffab808f03..aab70355d64f 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 a002cf12eb6c..bc9e129ab3d1 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -9014,8 +9014,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