From patchwork Mon Apr 4 16:53:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 12800573 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 4470DC433F5 for ; Mon, 4 Apr 2022 16:54:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C939D6B0071; Mon, 4 Apr 2022 12:53:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C42B76B0073; Mon, 4 Apr 2022 12:53:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE47F6B0074; Mon, 4 Apr 2022 12:53:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0076.hostedemail.com [216.40.44.76]) by kanga.kvack.org (Postfix) with ESMTP id 9BDD66B0071 for ; Mon, 4 Apr 2022 12:53:51 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 61C61AB2BB for ; Mon, 4 Apr 2022 16:53:41 +0000 (UTC) X-FDA: 79319793042.25.5A6D5EE Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by imf12.hostedemail.com (Postfix) with ESMTP id A0BE24002C for ; Mon, 4 Apr 2022 16:53:40 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 0987E3201D2F; Mon, 4 Apr 2022 12:53:38 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 04 Apr 2022 12:53:39 -0400 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 :message-id:mime-version:reply-to:reply-to:sender:subject :subject:to:to; s=fm3; bh=iE5HYjsyDrhb8gHe12sa/zLc2S6ikdXgUfBcf8 +yKi0=; b=SyzsSDStAvh1o2yCDwOVwCws8cpu+I55eGXZfR7qnsRSPBR4M6Hl1F 9ZH2pHc7PsT1hs3PQhQvHtD0JQwSR0eNXKQShLQMZAPqmDLQtxYLmvpR//z0E++N 99/p5M/9QWsqFMzyxO2TLGozFUWKsSAFcNspT9Sp0GXc6bS8mKGcYy7/u59L1oAu 7Gi73zaUZNGHl2Z6gY2XtdYAKqDYs2z8CbPH1vCWZOMB979dJ2taMaTl2gFAIZp1 jt2wVTqqM0lQ1bG3hGQtgGtg1aF0+Fruhw9NbPkQDrUJ5CTfEMBwGbzS3NadQJCo AU7EL1ViDgV6HazeuLFvMYIMI4cvKang== 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:message-id:mime-version: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=iE5HYjsyDrhb8gHe12sa/zLc2S6ik dXgUfBcf8+yKi0=; b=oBW5VwmG+K3jmQoLcOiV8hb76nF90lzElkDaeTLAClAhD ObVW9yy6g5U4zsvNcAbMOl8qZdTVJDctAcf4x7Xc1DkwhfP9qzJc5QO/JqtqCXJn OgzQMRXAZA13EloVpNIlhlSPUoE8H0Dd/E+oLWlBHlmzHn+E+Wl4jDdIpForQr9a e1HcO6g8gKtymM3ow+E7jxFGxWKqwf9q6oj3yrJJLxPgUtxI4hpGjduZLdFsocQo lC9kXVl4OyXsPhLiF7yY90xO2RblQkHPLprgcDX9xlFy/nPGNHUd4WUpOzFHSNKe Co5oeX4gDN1l7o1/Tgd6lAmhN6sUmd39efQw69AiA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudejvddguddtvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofhrggfgsedtqhertdertddtnecuhfhrohhmpegkihcujggr nhcuoeiiihdrhigrnhesshgvnhhtrdgtohhmqeenucggtffrrghtthgvrhhnpeetieeitd ejgffhfeeukeejvdeufedtvddulefhteduffeigfefteehgefhvdegudenucffohhmrghi nhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepiihirdihrghnsehsvghnthdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 4 Apr 2022 12:53:37 -0400 (EDT) From: Zi Yan To: linux-mm@kvack.org Cc: Matthew Wilcox , Michal Hocko , Naoya Horiguchi , Andrew Morton , linux-kernel@vger.kernel.org, Zi Yan , Naoya Horiguchi Subject: [PATCH] mm: migrate: use thp_order instead of HPAGE_PMD_ORDER for new page allocation. Date: Mon, 4 Apr 2022 12:53:25 -0400 Message-Id: <20220404165325.1883267-1-zi.yan@sent.com> X-Mailer: git-send-email 2.35.1 Reply-To: Zi Yan MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: uxuheczeahnikfzrqrjb5m9yiiutknds Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=sent.com header.s=fm3 header.b=SyzsSDSt; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=oBW5VwmG; spf=pass (imf12.hostedemail.com: domain of zi.yan@sent.com designates 64.147.123.21 as permitted sender) smtp.mailfrom=zi.yan@sent.com; dmarc=pass (policy=none) header.from=sent.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: A0BE24002C X-HE-Tag: 1649091220-889101 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 With folios support, it is possible to have other than HPAGE_PMD_ORDER THPs, in the form of folios, in the system. Use thp_order() to correctly determine the source page order during migration. Fixes: d68eccad3706 ("mm/filemap: Allow large folios to be added to the page cache") Reported-by: Naoya Horiguchi Link: https://lore.kernel.org/linux-mm/20220404132908.GA785673@u2004/ Signed-off-by: Zi Yan --- mm/mempolicy.c | 2 +- mm/migrate.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 6b34c5d5e65a..88a74bc4cba5 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1209,7 +1209,7 @@ static struct page *new_page(struct page *page, unsigned long start) struct page *thp; thp = alloc_hugepage_vma(GFP_TRANSHUGE, vma, address, - HPAGE_PMD_ORDER); + thp_order(page)); if (!thp) return NULL; prep_transhuge_page(thp); diff --git a/mm/migrate.c b/mm/migrate.c index 4639dfc2b7ee..b58b96fdb174 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1553,7 +1553,7 @@ struct page *alloc_migration_target(struct page *page, unsigned long private) */ gfp_mask &= ~__GFP_RECLAIM; gfp_mask |= GFP_TRANSHUGE; - order = HPAGE_PMD_ORDER; + order = thp_order(page); } zidx = zone_idx(page_zone(page)); if (is_highmem_idx(zidx) || zidx == ZONE_MOVABLE)