Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4011261rdh; Tue, 28 Nov 2023 09:22:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IHl9ufaxf27nysWwy0KkuEHvlWsTciGFIBGe6vS4poMTn3aewZS5CjBEc34LRqsxRKM6W17 X-Received: by 2002:a05:6a20:258e:b0:18c:1019:3e21 with SMTP id k14-20020a056a20258e00b0018c10193e21mr11858643pzd.39.1701192172090; Tue, 28 Nov 2023 09:22:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701192172; cv=none; d=google.com; s=arc-20160816; b=JIRPb8FKjC/vQBt5DF3tIYDbCZxoDJ6C6IdyZb9dsk0jeWTxY5rPFSOa64Am7WDjhu ExPtTKbddno0n/tMG/QM4UKwZ4vc3qEUy2i2xUttQHcTOk9TLQhP23TzZVKveZSYxST8 plvx+q9W8myiqrV/z54VI4XcqRj1vuHVXbfN0oCGQM/txovTg/UMJQ4TU66Kv56Txe5f V23QOb9SEMoe0kCKKpazhDqcK/AoAIzB/PP/RCpCYK0NQTWV6OsUUqr6tdjSmG5w0Lyi wO3wEZvQWwzL6qmjmhXa8aRSAUuUhmH3JRAORJby875mienQjUTx+U/x9i7r+l/OVTHs BWAg== 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; bh=kH/XzlZMX8Ixh1+AuqOipvEBoTIRxmoJmgvalr7cNQA=; fh=GvPR3+MhJ94K1qpVdR4jBnqAErFwWBoBDK/6pAFDFkc=; b=KV4S68JsOmWPy2rLJo/pbj5asNrFRC4foK3Yhe/fiyp0qQY34+A8qnIiyRg2JLl+Oo M4/0u1raZWnkQ+YIYM0lMULuC4ObLqdF4+EmzCl4K5jPcQTORk/MGJcxBCGYG4GpOg+c h6h+WxS4P9+USeBaIoY/WrMAbnk6t9ybUb45xTqCx4ZN7CUknCymvXk49NI1i71A8pQw OJLyCyaPcz9li02dJX4uXEp2A/WGHOlFVajUBGtHfoWjV8kI45QLCKORNjzkn68hu2yI IbPgcNX/ZuNJPEjmVFF6AJyHveTwihWqb/NdRWEFDqmIwJe6ksWT6POoEpgiTojpdkh1 WMUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id t11-20020a65608b000000b00573fc592e9dsi12281348pgu.848.2023.11.28.09.22.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 09:22:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C321980425A6; Tue, 28 Nov 2023 09:22:03 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345979AbjK1RVm (ORCPT + 99 others); Tue, 28 Nov 2023 12:21:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234824AbjK1RVg (ORCPT ); Tue, 28 Nov 2023 12:21:36 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 27FE019A2; Tue, 28 Nov 2023 09:21:39 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 388A1C15; Tue, 28 Nov 2023 09:22:26 -0800 (PST) Received: from raptor (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D45D33F6C4; Tue, 28 Nov 2023 09:21:33 -0800 (PST) Date: Tue, 28 Nov 2023 17:21:31 +0000 From: Alexandru Elisei To: Mike Rapoport 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: References: <20231119165721.9849-1-alexandru.elisei@arm.com> <20231119165721.9849-5-alexandru.elisei@arm.com> <20231125100322.GH636165@kernel.org> <20231128064957.GI636165@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231128064957.GI636165@kernel.org> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 28 Nov 2023 09:22:03 -0800 (PST) Hi, On Tue, Nov 28, 2023 at 08:49:57AM +0200, Mike Rapoport wrote: > On Mon, Nov 27, 2023 at 11:52:56AM +0000, Alexandru Elisei wrote: > > Hi Mike, > > > > I really appreciate you having a look! > > > > On Sat, Nov 25, 2023 at 12:03:22PM +0200, Mike Rapoport wrote: > > > 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. > > > > I did it this way so an arch won't be able to remove flags set by the MM code. > > There's a similar pattern in do_mmap() -> calc_vm_flag_bits() -> > > arch_calc_vm_flag_bits(). > > Ok, just add a sentence about it to the commit message. Great, will do that! Thanks, Alex > > > Thanks, > > Alex > > > > > > > > > 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. > > > > > -- > Sincerely yours, > Mike. >