Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp895593rdb; Sun, 18 Feb 2024 18:10:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWB6ZgpOB4TdA3VZRwPcnneZhe3vh+/N98ezoH/oFE4Arhr3bDBF6RIXprjXP/MoX2hF7yg100sJ/oW61rqh9Byf/mfoWj5dzFpBO2Oww== X-Google-Smtp-Source: AGHT+IHr/BvYAw+Xl6KkNUy0sf0j5hH9DVu9H8m6tpx90BdrsAHf2YrAyxGuzmNfErOZN9ceR1Xy X-Received: by 2002:a17:90a:d48f:b0:299:519b:7108 with SMTP id s15-20020a17090ad48f00b00299519b7108mr2762068pju.9.1708308644994; Sun, 18 Feb 2024 18:10:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708308644; cv=pass; d=google.com; s=arc-20160816; b=Xbr2u9YrlGyElpOU2nzHEyHffWk3pzw6d/7usvnbEAKA5CRq23pbM1LC84sGfEqE0c F+1u1Ms6G6HpgxCVstKexUjbTUenput5Fym3zfnpJnIJy1FnvWRzCHylfdwMIe7bn4oQ i5u9y2amE5GRlH7buqgP04Te+MqKu88uakCpxYdBrKccwHhaUK1qpFQZlgMrrDrkgAkd UzrUFEvl2+1cm+4/eCR2ID5JHWqNFt+G+JtUz/6WdkyKu5AXwdPo7S4Jm8CVMRCuBxFM afBlDKV5nQnMXhsy+JgTQJe07Ji00nXYzDOldHVHDsqexApDgkYs0Yj44EiwJgOtRXZ+ QB9g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=+kf4CuMDkj6hq86EOVyUbdblv4cca1uuSXGuLz8upuA=; fh=H1AXMuko56EfY+4pMcUqDLIow0rsGAnFgbDVYODEbGY=; b=n5br6he2AK43Cru/SBw94XmJ61hUI/+ljd2nSPpIa7nPN+2nMPk+0VAVdJhR+IohY7 KcGvGqhKM7MnZk8QJyo2YsSpAr0wZ7b6fnZ4WRQAq8gpSnFbYzVnOYTiMPqLG79uB3iy qzt7i6lfMG/QdRIFLdJdGpbU/uxCWHv6aNS7K2Ld7pUtjfz6+4RFv85a7usyZ/7qD0EK H7uxQRDcCYCHXelu7ylgqZhji6AgYTkYekWLIf7hXHulShFcCwnEGwsX/6XTW++mVQPP VU4yH1JE94wgmAhSh8rTphyb8uMIX8gW3eWvDD5cFowjlf22mFu4Aq50G9IrO0Zjrqyy 3Nfg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-kernel+bounces-70645-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70645-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ng1-20020a17090b1a8100b00298f66dd39esi3768815pjb.3.2024.02.18.18.10.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 18:10:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70645-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-kernel+bounces-70645-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70645-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AC709281116 for ; Mon, 19 Feb 2024 02:10:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1FE861FC4; Mon, 19 Feb 2024 02:10:39 +0000 (UTC) Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A44CEDD for ; Mon, 19 Feb 2024 02:10:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=166.125.252.92 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708308638; cv=none; b=JRf/vBZdvYguzbW7C7AUr0y5PSNagZc5ChIpczXrLTDVT/cjLGryk+UslF9dzaS5L1yUsGJ6GT/c2XrTG/o8IPbgXoSmcKGL1bW8/lacMM4I2zicGx/hiw5dWGdOyg/TDCg7mdX/rX1VTFd7clnY1U2ZChIOYNlRe6AXdoNM2vs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708308638; c=relaxed/simple; bh=ESY7KDK5jsdQuinHnP/MzJCYbXZq0VP+8cfLJR91cKw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ibq8a0z74bKIr5sTV2+pVnsS/RfNm6eOiPOBaFiytpv6oSlaFfNmUW0lg6br0sRezPD6GDFHZ1c7T8CIa+2nDGWJfmhPagoJhb3JlcVH2TeZF03FpyEPVvat/dy4/tLbHIUwnKi93sAxWhcpkMZz8X6ce20fn6XLGlC+GrOxZA4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com; spf=pass smtp.mailfrom=sk.com; arc=none smtp.client-ip=166.125.252.92 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sk.com X-AuditID: a67dfc5b-d6dff70000001748-84-65d2b8979e0c Date: Mon, 19 Feb 2024 11:10:26 +0900 From: Byungchul Park To: Oscar Salvador Cc: 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, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel_team@skhynix.com, akpm@linux-foundation.org Subject: Re: [PATCH v3] sched/numa, mm: do not promote folios to nodes not set N_MEMORY Message-ID: <20240219021026.GB65758@system.software.com> References: <20240216114045.24828-1-byungchul@sk.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjkeLIzCtJLcpLzFFi42LhesuzSHfGjkupBhseclrMWb+GzeLS46ts FtNfNrJYPJ2wldnibv9UFovLu+awWdxb85/VYvK7Z4wWlw4sYLI4M63I4njvASaLfR0PmCw6 jnxjtth69Du7A5/HmnlrGD1a9t1i91iwqdRj8wotj02fJrF73Lm2h83jxIzfLB7v911l89h8 utrj8ya5AK4oLpuU1JzMstQifbsEroyLE66xFCwRrXjzZQdLA+NugS5GTg4JAROJp0eXMMPY 147dZgOxWQRUJa78/8oEYrMJqEvcuPETrEZEQE1i2qtG9i5GLg5mgVNMEhM+XwByODiEBSIl Dr0VBKnhFbCQuLhqNdgcIYFuRonD93Ig4oISJ2c+YQGxmQW0JG78e8kE0sosIC2x/B8HSJhT wFRi+/I5YCWiAsoSB7YdZwJZJSHQzC7xYVo3I8SdkhIHV9xgmcAoMAvJ2FlIxs5CGLuAkXkV o1BmXlluYmaOiV5GZV5mhV5yfu4mRmAsLav9E72D8dOF4EOMAhyMSjy8GSKXUoVYE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132K1uPbWwUvr4hSpHP4WjUtq1CDbn7L1m1a5qryQXe Vzi9XeUWf0pPb7uzX9/csy86lFiKMxINtZiLihMB7TxPFIgCAAA= X-CFilter-Loop: Reflected On Sun, Feb 18, 2024 at 08:46:16AM +0100, Oscar Salvador wrote: > On Fri, Feb 16, 2024 at 02:51:24PM +0100, Oscar Salvador wrote: > > On Fri, Feb 16, 2024 at 08:40:45PM +0900, Byungchul Park wrote: > > > From 150af2f78e19217a1d03e47e3ee5279684590fb4 Mon Sep 17 00:00:00 2001 > > > From: Byungchul Park > > > Date: Fri, 16 Feb 2024 20:18:10 +0900 > > > Subject: [PATCH v3] sched/numa, mm: do not promote folios to nodes not set N_MEMORY > > > > "do not try to promote folios to memoryless nodes" > > Thinking some more, promote might be misleading, just something like > "do not try to migrate memory to memoryless nodes". Thank you. I will. > As this is not a bug fix but an optimization, as we will fail anyways > in migrate_misplaced_folio() when migrate_balanced_pgdat() notices that > we do not have any memory on that code. > > With the other comments addressed: > > Reviewed-by: Oscar Salvador Thank you for reviewing. Byungchul > > because AFAICS we are just trying. > > Even if should_numa_migrate_memory() returns true, I assume that we will > > fail somewhere down the chain e.g: migrate_pages() when we see that this > > node does not any memory, right? > > > > > A numa node might not have its local memory but CPUs. Promoting a folio > > > to the node's local memory is nonsense. So avoid nodes not set N_MEMORY > > > from getting promoted. > > > > If you talk about memoryless nodes everybody gets it better IMHO. > > "Memoryless nodes do not have any memory to migrate to, so stop trying it." > > > > > > > Signed-off-by: Byungchul Park > > > --- > > > kernel/sched/fair.c | 7 +++++++ > > > 1 file changed, 7 insertions(+) > > > > > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > > > index d7a3c63a2171..7ed9ef3c0134 100644 > > > --- a/kernel/sched/fair.c > > > +++ b/kernel/sched/fair.c > > > @@ -1828,6 +1828,13 @@ bool should_numa_migrate_memory(struct task_struct *p, struct folio *folio, > > > int dst_nid = cpu_to_node(dst_cpu); > > > int last_cpupid, this_cpupid; > > > > > > + /* > > > + * A node of dst_nid might not have its local memory. Promoting > > > + * a folio to the node is meaningless. > > > + */ > > > + if (!node_state(dst_nid, N_MEMORY)) > > > + return false; > > > > "Cannot migrate to memoryless nodes" > > > > seems shorter and more clear. > > > > So, what happens when we return true here? will we fail at > > migrate_pages() I guess? That is quite down the road so I guess > > this check can save us some time. > > > > > > -- > > Oscar Salvador > > SUSE Labs > > > > -- > Oscar Salvador > SUSE Labs