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 9E44FC83030 for ; Thu, 3 Jul 2025 11:54:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 37B6F6B017C; Thu, 3 Jul 2025 07:54:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 352DF6B017D; Thu, 3 Jul 2025 07:54:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21AA16B017E; Thu, 3 Jul 2025 07:54:27 -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 0F0316B017C for ; Thu, 3 Jul 2025 07:54:27 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id AE0E014018B for ; Thu, 3 Jul 2025 11:54:26 +0000 (UTC) X-FDA: 83622795732.21.2F563EB Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf24.hostedemail.com (Postfix) with ESMTP id 3D33C180008 for ; Thu, 3 Jul 2025 11:54:23 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=gMiPYKOA; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="X6P3Hf/D"; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=gMiPYKOA; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="X6P3Hf/D"; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf24.hostedemail.com: domain of hare@suse.de designates 195.135.223.131 as permitted sender) smtp.mailfrom=hare@suse.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1751543664; a=rsa-sha256; cv=none; b=YWIIp3C6ekIu4IYeXJFnHkyID6VmN3qcZ7Uhk7FJWmzcKoSwoEQrNq/Z9kh0lksAe8zP5A 4HvrD49Me83H6AnEshYmF+MPsTBkFR5r8FTNYklTQqUG/62ybM/6ILFsABrZeWOweIKZ9v fnT5SnW94ZpM2WvThizvV5IujJBqT24= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=gMiPYKOA; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="X6P3Hf/D"; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=gMiPYKOA; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="X6P3Hf/D"; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf24.hostedemail.com: domain of hare@suse.de designates 195.135.223.131 as permitted sender) smtp.mailfrom=hare@suse.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1751543664; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=RE1B4SIcgKBbZ1r5VusRtBpOzP0a8QwJi9xck/iiBnc=; b=JFg2mmJpGx2abpHKLao4GNvfSqyCTCPnFE9EI5sBsIYZshee0SBf65YjhvSbyOPA+FFfLX QEXoK9rH8e1PMJLg1QWIK7Y1aNz48V5dG3L6rxokFcAL7lVy17zBiBusmnXJOGdKI+9iP3 UPRaBZi6tTuPqCmGKRs0cA3I8fQWNXI= Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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-out2.suse.de (Postfix) with ESMTPS id 410801F387; Thu, 3 Jul 2025 11:54:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751543662; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RE1B4SIcgKBbZ1r5VusRtBpOzP0a8QwJi9xck/iiBnc=; b=gMiPYKOAv3WHRK/tKeg8ytnkRN+Xp++KPiMEUJg/+fJbOc1UNfrx/FTpNL0QHOadT6ImQg 5APSTrcHgJwOJIEFZWqgx803G5sVhnDtHR+J3545dg7YCZW8GIooymFJvkO6fYsMdPAjFz GX0ILwT7f8qpvPkh2viu2kfrdpGpKHI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751543662; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RE1B4SIcgKBbZ1r5VusRtBpOzP0a8QwJi9xck/iiBnc=; b=X6P3Hf/DweXexXCUx+LQlgFB7s1tu+AgvZQwbulbZSNk/6I+Bvo13phC7t2sWbpinbHpd4 I8Wgh+U+Gz7SASDg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1751543662; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RE1B4SIcgKBbZ1r5VusRtBpOzP0a8QwJi9xck/iiBnc=; b=gMiPYKOAv3WHRK/tKeg8ytnkRN+Xp++KPiMEUJg/+fJbOc1UNfrx/FTpNL0QHOadT6ImQg 5APSTrcHgJwOJIEFZWqgx803G5sVhnDtHR+J3545dg7YCZW8GIooymFJvkO6fYsMdPAjFz GX0ILwT7f8qpvPkh2viu2kfrdpGpKHI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1751543662; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RE1B4SIcgKBbZ1r5VusRtBpOzP0a8QwJi9xck/iiBnc=; b=X6P3Hf/DweXexXCUx+LQlgFB7s1tu+AgvZQwbulbZSNk/6I+Bvo13phC7t2sWbpinbHpd4 I8Wgh+U+Gz7SASDg== 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 2E01913983; Thu, 3 Jul 2025 11:54:22 +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 jkGMCm5vZmgqMgAAD6G6ig (envelope-from ); Thu, 03 Jul 2025 11:54:22 +0000 Message-ID: Date: Thu, 3 Jul 2025 13:54:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/3] mm/memory_hotplug: activate node before adding new memory blocks To: David Hildenbrand , Hannes Reinecke Cc: Oscar Salvador , linux-mm@kvack.org References: <20250702073913.58247-1-hare@kernel.org> <20250702073913.58247-3-hare@kernel.org> <3a790038-cd63-4c4f-af05-e98aecb56bb8@redhat.com> Content-Language: en-US From: Hannes Reinecke In-Reply-To: <3a790038-cd63-4c4f-af05-e98aecb56bb8@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Action: no action X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 3D33C180008 X-Stat-Signature: tcg3mnsf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7oQTobWDkMlZzPxPmgoQx+ME9YtZRoEMqUS4xE/BCTAqnB3/5SLlkWcYhnh00xJz8m4rruU5zPSLjBTW3/xjAEZXFddZ0G541gDCC9bQ9wz7+rqDdSIPYPPrrkAHWXXbzalRrsn9n8MHzWxdshDYZ7VT2o2y7NDOjJpO2dCIE4vRFzcwg4CyRErh1R4CoM7UNOAA+VSko6N0+evdfTVTpflzJozX2OY+MVtqC6DX83eUKD4aEEBMl27NXZL18wpo06RnDiyKbGVmKiWpXRwWGg7H2Y4e8C0ppEfDhoSfnlIwCagPPMO74vpJwxdZBcJOCnszcAP1HK6cC2mZwxW0e6n+x2Ng+qaidTvT5hw1XOHvfjT0kak7ZHH317nTX3x6f24OG6bNwDO+xnaVGlQeNg== 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 7/3/25 13:29, David Hildenbrand wrote: > On 02.07.25 09:39, Hannes Reinecke wrote: >> The sysfs attributes for memory blocks require the node ID to be >> set and initialized, so move the node activation before adding >> new memory blocks. This also has the nice side effect that the >> BUG_ON() can be converted into a WARN_ON() as we now can handle >> registration errors. >> >> Fixes: b9ff036082cd ("mm/memory_hotplug.c: make add_memory_resource >> use __try_online_node") > > We should CC stable. > Yeah, that's probably not a bad idea. >> Signed-off-by: Hannes Reinecke >> --- >>   drivers/base/memory.c  | 19 +++++++++---------- >>   include/linux/memory.h |  2 +- >>   mm/memory_hotplug.c    | 32 +++++++++++++++++--------------- >>   3 files changed, 27 insertions(+), 26 deletions(-) >> >> diff --git a/drivers/base/memory.c b/drivers/base/memory.c >> index 2b951e5f8a27..d24a90e0ea96 100644 >> --- a/drivers/base/memory.c >> +++ b/drivers/base/memory.c >> @@ -810,15 +810,14 @@ void memory_block_add_nid(struct memory_block >> *mem, int nid, >>               mem->zone = early_node_zone_for_memory_block(mem, nid); >>           else >>               mem->zone = NULL; >> +        /* >> +         * If this memory block spans multiple nodes, we only indicate >> +         * the last processed node. If we span multiple nodes (not >> applicable >> +         * to hotplugged memory), zone == NULL will prohibit memory >> offlining >> +         * and consequently unplug. >> +         */ >> +        mem->nid = nid; >>       } >> - >> -    /* >> -     * If this memory block spans multiple nodes, we only indicate >> -     * the last processed node. If we span multiple nodes (not >> applicable >> -     * to hotplugged memory), zone == NULL will prohibit memory >> offlining >> -     * and consequently unplug. >> -     */ >> -    mem->nid = nid; > > I would not perform this change in this patch. It's not required here, > right? We're simply re-setting the nid. Patch #3 can clean that up. > Well. You tell me :-) Thing is, we already have a 'nid' value as argument to add_memory_resource(). So I would _think_ that it should be the same value which we end up with in memory_block_add_nid(). But if that's the case we could've set it during memblock initialization, which we don't. So I thought there must be a reason for that, and the only reason I could think of is that 'nid' is not known during memblock initialization, ie that the 'nid' value in add_memory_resource() is a different 'nid' value from the one used in memory_block_add_nid(). If so then we cannot leave out. If not, then indeed, we can leave it out. Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich