Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp1762836rdh; Sat, 25 Nov 2023 02:04:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IGXHZmRXzxau9lsV5EG2o9X5TsR8BUbN1XntjJ0MExY81dIW17Jk9sujV5pjwpa0q9HJdj0 X-Received: by 2002:a05:6a00:2410:b0:6cb:903a:b064 with SMTP id z16-20020a056a00241000b006cb903ab064mr6304352pfh.22.1700906696365; Sat, 25 Nov 2023 02:04:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700906696; cv=none; d=google.com; s=arc-20160816; b=ecMx2v37lac+i03mZdVPbfHiFVXZDXyfgYfqYdRnTccFs79EKsOVj5zfRUstJIejv/ sOmI9vN5uenyQrpFk74GuWRCEvc2LdU1BUuhPEci8/paljeui9thimdWvW/wlX6VOWtO XuJSNNe063RL173xMOnpaQb4fZpFy4gw4vbasfd/PeoUDUiMYHjFPEAN3WBLpFt5I2fG HM/yf1j4fabZ9JaWQgrXyrM7DNuG0TiwQEbAqglpuJyHy/i07/YCUn1gFTgAsdQGiPPf dBuWdDgl4olsEkYkd208y4LBYFyMILGusd6f9MznqI/tErx0STJ8cUuuppeD1ALQvwK9 mhDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kLE4IRjWf77JlCuwUSkmhXl/3/2gI7dIwSPNxFBPrtM=; fh=1QNTnXWELpAa0l3eKdRIQV+6e8FhoSoNhAGwB8AiE1o=; b=p28OBTfyqya3eQd6lv5+kS1KmyyS2rZnQEhSQkH2CtIa1swf+/XjRPNhkcHmDIwsPD PHBZP/RuQYG+S5ixZ9Ic9QiYNzAEZ3Wrn4/OeO8m/vvOrRVfUOh2eYk4x7VqrxXr0ovh Xk9tG2M8sz6WqM6xRfXOiRnGKtfGCmdIGLBNkNCB6ZZ1o8D+Q+HIgBffQW2LG0zOaqQ4 6jpnB5yAiSr/VB/z/WxSjM/adsIWmqrrcAsq1nFkrFmco2YcxPeRMxGfgoo8LrNy0H8z IVM+0E07oySW1v/ppoTKJf7xvd9WeZ36AWszghAzS+Jb18BSrLKL8NNQXQ69vZJUrM4W MIHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jJr6hJe4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id u11-20020a056a00124b00b006be3c302801si5484563pfi.397.2023.11.25.02.04.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 02:04:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jJr6hJe4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id A40DA80A18E0; Sat, 25 Nov 2023 02:04:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231916AbjKYKDk (ORCPT + 99 others); Sat, 25 Nov 2023 05:03:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231861AbjKYKDg (ORCPT ); Sat, 25 Nov 2023 05:03:36 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D12F310E2 for ; Sat, 25 Nov 2023 02:03:42 -0800 (PST) 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231119165721.9849-5-alexandru.elisei@arm.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sat, 25 Nov 2023 02:04:53 -0800 (PST) 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.