From patchwork Wed Apr 6 15:18:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 12803615 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 A9A19C433FE for ; Wed, 6 Apr 2022 15:21:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DBE276B0078; Wed, 6 Apr 2022 11:19:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D6DA26B007B; Wed, 6 Apr 2022 11:19:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE7D96B007D; Wed, 6 Apr 2022 11:19:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0109.hostedemail.com [216.40.44.109]) by kanga.kvack.org (Postfix) with ESMTP id AD85B6B0078 for ; Wed, 6 Apr 2022 11:19:57 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 594BA18356CE8 for ; Wed, 6 Apr 2022 15:19:47 +0000 (UTC) X-FDA: 79326814014.25.7535FE1 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by imf19.hostedemail.com (Postfix) with ESMTP id B337B1A0037 for ; Wed, 6 Apr 2022 15:19:46 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id D8F643201FB7; Wed, 6 Apr 2022 11:19:44 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 06 Apr 2022 11:19:45 -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=fm3; bh=GCOCd LBvER1uJBwqDC45zH4ip40h8EDSqkmzj6WuqzU=; b=zPfsw7WVg7lfi3ByClDpx 0pg9uXOgZUC08+l+yyQFqE/eWFZSlTarVl1MDvLMXRaa/2/ZjcdDop5ig6LPxi2i j4kYOFR+TfFnmhQjpjSW6gsIDoqKEK0PWamdmqO+JnFlJmkgHejLe0IiZyGxWjQD 9WWj7qlEhpZgWgBRjHaasWpxWQcFb7zMrClnM1yQnyvYCssZt0ow5jkcZLYVsEk3 c0XziZ6YfQ/WRX92FzBENRpSTtmiPTNyw4WE1xi78f5AM4FX9p2aBudIvQmyECGh LbL6zIfdkVXNwSezQziFhLdIx4tgP4C1PXbuT26IiS3FN7uLTovmozdRHHoz6Wsg w== 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=fm3; bh=GCOCdLBvER1uJBwqDC45zH4ip40h8 EDSqkmzj6WuqzU=; b=OMSf9dZuR5EciBZYw7arT4M33IWjH+Ipyhk6Cd7wYEOza HMk/7C/mj6f0/M8yxDOjreUfQh75YaBjABO/8bsuvZPjvjNTEG2qKyu3lgvslmV3 rYMKZTWZVAQWASYCBawcC403d7dEaQDbB6ktvqtHcMrpKbDtwJjffRcG7FLJVPrb DFPy6QA3t94cQWyzizf0hHmhExwOwtvQTYscmk84E9LGpgc7jdzNm02a3B9kkwGo Tt95wUjhhdunZJFqi2w0/VfS6YCobp5rPgUh5IHQn7R0KovLFxG43hHvnD/UQEu1 kRQ/y3ACK7zjDl5Eiv+J8omBHjVjbS+zJ50CcI2YA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudejiedgkeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfrhggtgfgsehtqhertdertdejnecuhfhrohhmpegkihcu jggrnhcuoeiiihdrhigrnhesshgvnhhtrdgtohhmqeenucggtffrrghtthgvrhhnpeekgf fgleejfeegjedttefhhedvgfffvdeffeekjeetgffhtedvudffkeegleettdenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpeiiihdrhigrnhessh gvnhhtrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 6 Apr 2022 11:19:44 -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 , Zi Yan Subject: [PATCH v10 4/5] mm: cma: use pageblock_order as the single alignment Date: Wed, 6 Apr 2022 11:18:57 -0400 Message-Id: <20220406151858.3149821-5-zi.yan@sent.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220406151858.3149821-1-zi.yan@sent.com> References: <20220406151858.3149821-1-zi.yan@sent.com> Reply-To: Zi Yan MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: B337B1A0037 X-Stat-Signature: tn4h749xka8pn983mig5x7rmua4rt9tc Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=sent.com header.s=fm3 header.b=zPfsw7WV; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=OMSf9dZu; dmarc=pass (policy=none) header.from=sent.com; spf=pass (imf19.hostedemail.com: domain of zi.yan@sent.com designates 64.147.123.24 as permitted sender) smtp.mailfrom=zi.yan@sent.com X-Rspam-User: X-HE-Tag: 1649258386-283129 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 2148d3d00a70..29bb5177a7f5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -9000,8 +9000,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