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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B4AAC48BC4 for ; Sun, 18 Feb 2024 07:45:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 63A986B009E; Sun, 18 Feb 2024 02:45:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5EA186B009F; Sun, 18 Feb 2024 02:45:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 48A046B00A0; Sun, 18 Feb 2024 02:45:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 347416B009E for ; Sun, 18 Feb 2024 02:45:10 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id CC06740114 for ; Sun, 18 Feb 2024 07:45:09 +0000 (UTC) X-FDA: 81804138738.24.8974787 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf21.hostedemail.com (Postfix) with ESMTP id 7390C1C0012 for ; Sun, 18 Feb 2024 07:45:07 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=OzY6l413; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=zoqJA3fA; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=OzY6l413; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=zoqJA3fA; spf=pass (imf21.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.131 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708242307; a=rsa-sha256; cv=none; b=HKhpK6nBFBjdQWscW+zUkN5G0CQxNST49UBNRLdWFG5pmxydgUfkDYC0ClA8FWXazhWTgR ZBX3cYa0A3EG1iWsR/2rT2Pu565K6EAgrWa7mMrZS+LWbn8ExLMZpcUDD7ar2NBMEsP8cu m3g7+TjoVXvGemhJGSuhDiJLi7LKcM4= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=OzY6l413; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=zoqJA3fA; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=OzY6l413; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=zoqJA3fA; spf=pass (imf21.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.131 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708242307; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=evZe4gckZRBHDhEto05F1VL+BEBk5Sw8m/1sqWCtavg=; b=Wt1aZVgNx0bG4rMZg30jCUX5Tc64h0Ap7qtK2mG6Y/S7Zu90FDdmo40r61B04anYQC8b4M ETrf72Lwzoz+bDe7YdDiaICw7BRQq4qvkT9wrkfV0+6NjY2z9vi6YS63Vso9qe3kr6PJvW NISkNn3rLpaMiUzBhX20d11uZTevE4w= Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 7FC111FBF2; Sun, 18 Feb 2024 07:45:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1708242305; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=evZe4gckZRBHDhEto05F1VL+BEBk5Sw8m/1sqWCtavg=; b=OzY6l413AqV4NamRaozr+xOUFtfEXlLQ7MgbOxFYE5nHINtEwheLgKGD3oxK+tWA/LWMfP +sB/ewyB2QysnXjnaIgGaEtlMk2BqbpQL6zsXVBKxaw3LX9a/w24zYzbZXXFtnvWDdRTbJ hKd3aPSXYtZfTiYhBDBxTdWpfc6xt6g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1708242305; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=evZe4gckZRBHDhEto05F1VL+BEBk5Sw8m/1sqWCtavg=; b=zoqJA3fAcIDCyvFIG4LK3eK8/G6U9OLxJxCQtkTiOaBRI5QRS6DFGpFV3SJKEZow1TP6cv 3CXhsc8JAs9Pe9DA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1708242305; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=evZe4gckZRBHDhEto05F1VL+BEBk5Sw8m/1sqWCtavg=; b=OzY6l413AqV4NamRaozr+xOUFtfEXlLQ7MgbOxFYE5nHINtEwheLgKGD3oxK+tWA/LWMfP +sB/ewyB2QysnXjnaIgGaEtlMk2BqbpQL6zsXVBKxaw3LX9a/w24zYzbZXXFtnvWDdRTbJ hKd3aPSXYtZfTiYhBDBxTdWpfc6xt6g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1708242305; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=evZe4gckZRBHDhEto05F1VL+BEBk5Sw8m/1sqWCtavg=; b=zoqJA3fAcIDCyvFIG4LK3eK8/G6U9OLxJxCQtkTiOaBRI5QRS6DFGpFV3SJKEZow1TP6cv 3CXhsc8JAs9Pe9DA== Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id A447413343; Sun, 18 Feb 2024 07:45:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id 1QK8JIC10WUaVQAAn2gu4w (envelope-from ); Sun, 18 Feb 2024 07:45:04 +0000 Date: Sun, 18 Feb 2024 08:46:16 +0100 From: Oscar Salvador To: Byungchul Park 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: References: <20240216114045.24828-1-byungchul@sk.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 7390C1C0012 X-Stat-Signature: rjnnxqzjgdtnqg9x8e9osca1mishgxwy X-Rspam-User: X-HE-Tag: 1708242307-175342 X-HE-Meta: U2FsdGVkX1/wnux1MReuivgr3De8Wwtjtk3g7rF38ecY5jgURTp8jeoA8ErQ3sMn+DoL+KcEjf0RMPpGFJrw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4NWH8WhfdS8bkUZ4d2FYhwC5Ofq/H8NeOOvwPMJskfefnqHulX3ovfyBI0U0ZwRGLuJTNdm8yszWMz5zPxzeK8I0xjVZ2Z2nYOs3M9aU7ggKiA X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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". 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 > > 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