Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3499365pxb; Mon, 4 Apr 2022 18:57:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVG8KRmo/6GrKVPFcRryIS+6D8zuEIYvvz2b+I5+mBoJYJZPQZPCtHUuUupnkiVlfjIhj/ X-Received: by 2002:a63:1f55:0:b0:382:65eb:3073 with SMTP id q21-20020a631f55000000b0038265eb3073mr914330pgm.624.1649123848531; Mon, 04 Apr 2022 18:57:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649123848; cv=none; d=google.com; s=arc-20160816; b=ghtk2EMo+UsPeVkvxBUlpiRWIJukqtkId1auiQcWg2uCSE8p/5/rBi/bNeqlXwi9Bn fe/+QPTbR3U/NX8iieQGQAzPQWwr7TI8PqjHfSjrn1j3nOFXNrX7ewQ2STJX72EcQv1v tgPJtjmVGf0IkknLJOvn7S7UVdBNOhnUgbq65+GRusQW6jvbUbhORvdDD1RjqtuFO4UT cLP8OsmzqEjGMP0xoKxpdoaXRE4OsHI/92IvAuE6iVZCntX3DKZXaDYrRDUGs8Jpsiwa 42VUiKFKa1QoWNUaasTTdhS0dFazWk/iGDXv4ph+MflVpID0JwLAgjG46akUOSpuR6zv PwMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=iE5HYjsyDrhb8gHe12sa/zLc2S6ikdXgUfBcf8+yKi0=; b=snP7oUCeu/xQEc+/l2bRm5B/qBr4WPEukTMEEyWeHw+s8MVG2JkRuh1g6txVW5mIoY reKpqDDNek4QmUSt/kPOl9YTuk7bik5fDBRULiz/Dp4/RCoYadVHAYA92SXkx7Eo2TEU uXZBKycRR0Sba6/JfOt1tk+sfRGiW1spfv8/yCLvhasWTQfqObsgcjIkHo30lTxtQ7+v 2jC7AFc/qvj/zp14/7StJaPKdkIQxzhb/37lwKRAHDIZUQW4/UozGD0oMhwhUlHGqcIw fHV37loFcUiTsa1KHBZHv3YCk3aRUk30BNYjOjlOLQ1LU6cSrJz/Ucpl5TtgXQLFqif/ +LXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sent.com header.s=fm3 header.b=SyzsSDSt; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=oBW5VwmG; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sent.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id oo10-20020a17090b1c8a00b001c72b71a7e4si729778pjb.27.2022.04.04.18.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 18:57:28 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@sent.com header.s=fm3 header.b=SyzsSDSt; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=oBW5VwmG; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sent.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CC1552DD3B6; Mon, 4 Apr 2022 18:02:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381006AbiDDVWT (ORCPT + 99 others); Mon, 4 Apr 2022 17:22:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379296AbiDDQzh (ORCPT ); Mon, 4 Apr 2022 12:55:37 -0400 Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6748B2D for ; Mon, 4 Apr 2022 09:53:39 -0700 (PDT) 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 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 pag= e 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, unsig= ned long start) struct page *thp; =20 thp =3D 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 &=3D ~__GFP_RECLAIM; gfp_mask |=3D GFP_TRANSHUGE; - order =3D HPAGE_PMD_ORDER; + order =3D thp_order(page); } zidx =3D zone_idx(page_zone(page)); if (is_highmem_idx(zidx) || zidx =3D=3D ZONE_MOVABLE) --=20 2.35.1