From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B271CC61D9D for ; Sat, 25 Nov 2023 10:04:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2vMhVEyNhxTsBAGkc631Q6SgCUBtiuuKVubowTa1bMo=; b=Xlwu5T7rIUUq93 26sYdFxfdwfYannv1ji30DwwvDP9UmTJ5jn5DcOJ5SI8IjDVH5Hll2UeOOpFh9s+yDYXfkjJ7VScd cQkGzy5fACSnQbhvysVu3kO+CreWpkC7+4F5MwxNbySpWJJZac2ugZsHAEFtBSPxtFQrRHHZqbt6k 3n23GnlwZiirayn4RjD+J3XAG3QIJV4YtzF16P94ZdPrQxPQtBFtaKas61o2NgA8adxaa6ZBAHmme RGOxXDM/2p+KojBbSNoT6D79ToILHUPpp7QvYcDu4/xr6IwC7g6xDmd0IgsoTO22+7lvW1iTP92qK EWj7ILFc8r5GPTBl3T+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r6pVs-008z2Q-1N; Sat, 25 Nov 2023 10:03:48 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r6pVp-008z1D-31 for linux-arm-kernel@lists.infradead.org; Sat, 25 Nov 2023 10:03:47 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 1144FCE2AA7; Sat, 25 Nov 2023 10:03:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51C7FC433C7; Sat, 25 Nov 2023 10:03:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700906622; bh=p2Y9N2XAI98q4rgvMYuaA64L0HRfC61PSCaNKkKNa08=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jJr6hJe4kA/IFAUVu+a8cU5PwRzwHnpFw+BVZV7Eazw1jADD5q48cknChA+YK0kN8 75wfNkXi0+hrIRRHvA55kPjFOdCjMIbK/Nkk6J8qugNc4KU2N3JpsizBoq9axvSDaa Ama3nZ62v0b1HOPzmQ34RJS4uA7Q85Cej3G/DZRQQRdtHL0nUXTyRy8I5kixlxPqkN A3S/bhP9BjywvJGFlYqE0IPpGyVfH/D+4vbA24fxy8h6mvVAKXzhtia7+p/TWtN8Xd nbnTiXnGyzJuCC696fLSjtzVxsHlbJEVUtDxOz+tdxa2r8pLb7IFNRXfBAm33IfoOR j2kX5KdSQknKw== Date: Sat, 25 Nov 2023 12:03:22 +0200 From: Mike Rapoport To: Alexandru Elisei Cc: catalin.marinas@arm.com, will@kernel.org, oliver.upton@linux.dev, maz@kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, arnd@arndb.de, akpm@linux-foundation.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, mhiramat@kernel.org, hughd@google.com, pcc@google.com, steven.price@arm.com, anshuman.khandual@arm.com, vincenzo.frascino@arm.com, david@redhat.com, eugenis@google.com, kcc@google.com, hyesoo.yu@samsung.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org Subject: Re: [PATCH RFC v2 04/27] mm: migrate/mempolicy: Add hook to modify migration target gfp Message-ID: <20231125100322.GH636165@kernel.org> References: <20231119165721.9849-1-alexandru.elisei@arm.com> <20231119165721.9849-5-alexandru.elisei@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231119165721.9849-5-alexandru.elisei@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231125_020346_363800_AE78371A X-CRM114-Status: GOOD ( 20.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sun, Nov 19, 2023 at 04:56:58PM +0000, Alexandru Elisei wrote: > It might be desirable for an architecture to modify the gfp flags used to > allocate the destination page for migration based on the page that it is > being replaced. For example, if an architectures has metadata associated > with a page (like arm64, when the memory tagging extension is implemented), > it can request that the destination page similarly has storage for tags > already allocated. > > No functional change. > > Signed-off-by: Alexandru Elisei > --- > include/linux/migrate.h | 4 ++++ > mm/mempolicy.c | 2 ++ > mm/migrate.c | 3 +++ > 3 files changed, 9 insertions(+) > > diff --git a/include/linux/migrate.h b/include/linux/migrate.h > index 2ce13e8a309b..0acef592043c 100644 > --- a/include/linux/migrate.h > +++ b/include/linux/migrate.h > @@ -60,6 +60,10 @@ struct movable_operations { > /* Defined in mm/debug.c: */ > extern const char *migrate_reason_names[MR_TYPES]; > > +#ifndef arch_migration_target_gfp > +#define arch_migration_target_gfp(src, gfp) 0 > +#endif > + > #ifdef CONFIG_MIGRATION > > void putback_movable_pages(struct list_head *l); > diff --git a/mm/mempolicy.c b/mm/mempolicy.c > index 10a590ee1c89..50bc43ab50d6 100644 > --- a/mm/mempolicy.c > +++ b/mm/mempolicy.c > @@ -1182,6 +1182,7 @@ static struct folio *alloc_migration_target_by_mpol(struct folio *src, > > h = folio_hstate(src); > gfp = htlb_alloc_mask(h); > + gfp |= arch_migration_target_gfp(src, gfp); I think it'll be more robust to have arch_migration_target_gfp() to modify the flags and return the new mask with added (or potentially removed) flags. > nodemask = policy_nodemask(gfp, pol, ilx, &nid); > return alloc_hugetlb_folio_nodemask(h, nid, nodemask, gfp); > } > @@ -1190,6 +1191,7 @@ static struct folio *alloc_migration_target_by_mpol(struct folio *src, > gfp = GFP_TRANSHUGE; > else > gfp = GFP_HIGHUSER_MOVABLE | __GFP_RETRY_MAYFAIL | __GFP_COMP; > + gfp |= arch_migration_target_gfp(src, gfp); > > page = alloc_pages_mpol(gfp, order, pol, ilx, nid); > return page_rmappable_folio(page); -- Sincerely yours, Mike. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel