From patchwork Tue Apr 1 09:27:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 14034576 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 2DA5CC3601A for ; Tue, 1 Apr 2025 09:27:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B173280008; Tue, 1 Apr 2025 05:27:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 30FDA280004; Tue, 1 Apr 2025 05:27:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1402E280008; Tue, 1 Apr 2025 05:27:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id DEF64280004 for ; Tue, 1 Apr 2025 05:27:42 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 7E0FF1624CD for ; Tue, 1 Apr 2025 09:27:44 +0000 (UTC) X-FDA: 83284947648.02.1C42196 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf23.hostedemail.com (Postfix) with ESMTP id 498A5140002 for ; Tue, 1 Apr 2025 09:27:42 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=xN6VL7l3; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7blGqOUv; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=xN6VL7l3; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7blGqOUv; spf=pass (imf23.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.130 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=1743499662; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=czY8Ikj4+P6N/A2ZD53YGUbiampkq/ZY/cKANaTlIWY=; b=73ejc16Kqla9bIEXPRUguPWyKUGS4ocbR1puS+Qua9pFqRcQQr+R+vC2uBnQ+noWh6TDrO AIXsgjv9RWjQy4YJuysbq7kWhLt5WcfU2JoGmzq5qBMm03N2YjQ3uB0TVMsSV8UECEswRX +z0iw73uNaz2IChzGNonN1EIWoKta1g= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743499662; a=rsa-sha256; cv=none; b=RDiydcpASFuhymBNTkOrPnUOnNY8EPetigRfVzBTI2UcEvoxGDGCc0rrPJ7TUCQGTW0NMj iaEHrQ8eJVloLvgn76BLJ5zgNEsS1ZZRkSC/p/Ji54X2KAv1M1l1mp7pXgjtNatWD2gs22 L9bDeTgfnnCYqLL4Zbp2mhHJkHsrqNw= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=xN6VL7l3; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7blGqOUv; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=xN6VL7l3; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7blGqOUv; spf=pass (imf23.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.130 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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-out1.suse.de (Postfix) with ESMTPS id C1CD621189; Tue, 1 Apr 2025 09:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1743499657; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=czY8Ikj4+P6N/A2ZD53YGUbiampkq/ZY/cKANaTlIWY=; b=xN6VL7l3V3TkZcNeC+qr2aF9Q1Fw86ZFgXHRkB7zMNDvwZ7FiDpy4fYzdOZMmBCPVS2BwQ y3tbkJWe3h4G9B2v3ATsl2hE3KWeXkNWWZ61ssPYaDiTGozuyjWcJekkfXtKPVHny/STpL +xIOOub6kALuQBHxZGqghUltzGqb76w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1743499657; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=czY8Ikj4+P6N/A2ZD53YGUbiampkq/ZY/cKANaTlIWY=; b=7blGqOUv+NwFyNdBkk73FxHbPAYT6RO3YZitrGczsryyfceUqylqic29t2MxzoLWMv8QC7 0a4wk1oer25v6pCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1743499657; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=czY8Ikj4+P6N/A2ZD53YGUbiampkq/ZY/cKANaTlIWY=; b=xN6VL7l3V3TkZcNeC+qr2aF9Q1Fw86ZFgXHRkB7zMNDvwZ7FiDpy4fYzdOZMmBCPVS2BwQ y3tbkJWe3h4G9B2v3ATsl2hE3KWeXkNWWZ61ssPYaDiTGozuyjWcJekkfXtKPVHny/STpL +xIOOub6kALuQBHxZGqghUltzGqb76w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1743499657; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=czY8Ikj4+P6N/A2ZD53YGUbiampkq/ZY/cKANaTlIWY=; b=7blGqOUv+NwFyNdBkk73FxHbPAYT6RO3YZitrGczsryyfceUqylqic29t2MxzoLWMv8QC7 0a4wk1oer25v6pCQ== Received: from imap1.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 33DAD13691; Tue, 1 Apr 2025 09:27:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id kFHxCYmx62cnfwAAD6G6ig (envelope-from ); Tue, 01 Apr 2025 09:27:37 +0000 From: Oscar Salvador To: Andrew Morton Cc: David Hildenbrand , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Vlastimil Babka , Hyeonggon Yoo <42.hyeyoo@gmail.com>, mkoutny@suse.com, Dan Williams , Jonathan Cameron , Oscar Salvador Subject: [PATCH 2/2] mm,memory_hotplug: Replace status_change_nid parameter in memory_notify Date: Tue, 1 Apr 2025 11:27:16 +0200 Message-ID: <20250401092716.537512-3-osalvador@suse.de> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250401092716.537512-1-osalvador@suse.de> References: <20250401092716.537512-1-osalvador@suse.de> MIME-Version: 1.0 X-Stat-Signature: tn3ffom5edx1cmxw4xmbmf95icctu75t X-Rspam-User: X-Rspamd-Queue-Id: 498A5140002 X-Rspamd-Server: rspam08 X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cqM0m2ZveRgZ9JaWLT3OOsq1mJKu0N4yLyzPeOek7Qe691PMzloAi63cpdtgBGO8P1+uvDxS8z9uAoI2iMCoT/g3BHtBfNCw5E+yvrHpeyOmkzlZopUzs/uIbrqPHt36++uR6pmp1BGQ4xRjvgEuCJK611scKLRtjQmpw0r143rx958ANkaAqfL79jCsgv4wzXo5wnLByvf5wS4grnMARekwZzEH1hgWFBqfDIGm9Oj4x6VBwapoGJBjtn/mu1C0qUhdQxeu8Uja79dZtlwd5E2jcSwz60EzxACxCC7QgzJoQv0AzGcT+1VhT2SY/YTHXcREyyflEwt 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: memory notify consumers are only interested in which node the memory we are adding belongs to, so replace current status_change_nid{_normal} fields with only one that specifies the node. Signed-off-by: Oscar Salvador Reviewed-by: Harry Yoo Reviewed-by: Vlastimil Babka --- include/linux/memory.h | 3 +-- mm/memory_hotplug.c | 6 ++---- mm/page_ext.c | 12 +----------- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/include/linux/memory.h b/include/linux/memory.h index 1d814dfbb8a8..4d8884578a1a 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h @@ -117,8 +117,7 @@ struct memory_notify { unsigned long altmap_nr_pages; unsigned long start_pfn; unsigned long nr_pages; - int status_change_nid_normal; - int status_change_nid; + int nid; }; struct node_notify { diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 4bb9ff282ec9..185d799c79e2 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1198,6 +1198,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages, mem_arg.start_pfn = pfn; mem_arg.nr_pages = nr_pages; + mem_arg.nid = nid; node_states_check_changes_online(nr_pages, zone, &node_arg); if (node_arg.status_change_nid >= 0) { @@ -1210,8 +1211,6 @@ int online_pages(unsigned long pfn, unsigned long nr_pages, } cancel_mem_notifier_on_err = true; - mem_arg.status_change_nid = node_arg.status_change_nid; - mem_arg.status_change_nid_normal = node_arg.status_change_nid_normal; ret = memory_notify(MEM_GOING_ONLINE, &mem_arg); ret = notifier_to_errno(ret); if (ret) @@ -2050,6 +2049,7 @@ int offline_pages(unsigned long start_pfn, unsigned long nr_pages, mem_arg.start_pfn = start_pfn; mem_arg.nr_pages = nr_pages; + mem_arg.nid = node; node_states_check_changes_offline(nr_pages, zone, &node_arg); if (node_arg.status_change_nid >= 0) { @@ -2061,8 +2061,6 @@ int offline_pages(unsigned long start_pfn, unsigned long nr_pages, } cancel_mem_notifier_on_err = true; - mem_arg.status_change_nid = node_arg.status_change_nid; - mem_arg.status_change_nid_normal = node_arg.status_change_nid_normal; ret = memory_notify(MEM_GOING_OFFLINE, &mem_arg); ret = notifier_to_errno(ret); if (ret) { diff --git a/mm/page_ext.c b/mm/page_ext.c index c351fdfe9e9a..477e6f24b7ab 100644 --- a/mm/page_ext.c +++ b/mm/page_ext.c @@ -378,16 +378,6 @@ static int __meminit online_page_ext(unsigned long start_pfn, start = SECTION_ALIGN_DOWN(start_pfn); end = SECTION_ALIGN_UP(start_pfn + nr_pages); - if (nid == NUMA_NO_NODE) { - /* - * In this case, "nid" already exists and contains valid memory. - * "start_pfn" passed to us is a pfn which is an arg for - * online__pages(), and start_pfn should exist. - */ - nid = pfn_to_nid(start_pfn); - VM_BUG_ON(!node_online(nid)); - } - for (pfn = start; !fail && pfn < end; pfn += PAGES_PER_SECTION) fail = init_section_page_ext(pfn, nid); if (!fail) @@ -436,7 +426,7 @@ static int __meminit page_ext_callback(struct notifier_block *self, switch (action) { case MEM_GOING_ONLINE: ret = online_page_ext(mn->start_pfn, - mn->nr_pages, mn->status_change_nid); + mn->nr_pages, mn->nid); break; case MEM_OFFLINE: offline_page_ext(mn->start_pfn,