From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 254BB276041 for ; Tue, 21 Apr 2026 03:55:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776743749; cv=none; b=TvWd8w24x3T6NcALI+QgofRTqApHQpiiig2GL/6bpJ9NI6XNZk9GXLISqOJbIIvBC8dbPrL8rEyGykYGlZAjC0wafe3F/McdsX7hJ4dQL9fgO0obDH7DcUk1aMI9GIo6e8sSVvzJPpal4IjE9+eVD9pFg9dtlBEGi4MNnic225Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776743749; c=relaxed/simple; bh=sdCwI0a4vyUzDgFV6XjSMGrwwcOfVpWqvEfdS6dSXuM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=n4/pIZtgBb8YSO2SdY1jxzgaFCkrRdsCo3UxMgWdG/iz6B4TSUlKnxCAPUrFxgHv4qrcv2kQCksGvOL03JDxv+S1t1bfwJp49HKi8ZdYQAGZT8dQax/TsAXaGMnW3F9VllUkZcxh6Q9XHij+PRZhr0I9NO8swA5FI0/dFqpKqY0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=z+aTATz0; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=bFbKc3gi; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=z+aTATz0; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=bFbKc3gi; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="z+aTATz0"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="bFbKc3gi"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="z+aTATz0"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="bFbKc3gi" 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-out2.suse.de (Postfix) with ESMTPS id 301705BCDB; Tue, 21 Apr 2026 03:55:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1776743746; 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=IDVUbgdLvJLIeQVXYQIqbs7pEdXqPLVFAHC8mrcXVSg=; b=z+aTATz0T6umjQ5O0z+TOGIn74fHWAefJyFfgsKaUncEB4dmC30Iq37o2gy1hsv8uUp89u oJmIEcBm9v4JB6hBc7kgD0Od9amhicQy9vYyZQj8ckQf+u6hBjG/3ICY+iOWCPHRP9UXQt LSPoJJ4TqwaF/FPM0wJm2OoxxHbZevA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1776743746; 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=IDVUbgdLvJLIeQVXYQIqbs7pEdXqPLVFAHC8mrcXVSg=; b=bFbKc3gikECZQSviGQs0y1uKj+LVkV0Wg3WuYg04UDC7GzXWXzmKSt7B9Z/5pUiF5l8Lwe nuLmnak/+N32IPAw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1776743746; 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=IDVUbgdLvJLIeQVXYQIqbs7pEdXqPLVFAHC8mrcXVSg=; b=z+aTATz0T6umjQ5O0z+TOGIn74fHWAefJyFfgsKaUncEB4dmC30Iq37o2gy1hsv8uUp89u oJmIEcBm9v4JB6hBc7kgD0Od9amhicQy9vYyZQj8ckQf+u6hBjG/3ICY+iOWCPHRP9UXQt LSPoJJ4TqwaF/FPM0wJm2OoxxHbZevA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1776743746; 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=IDVUbgdLvJLIeQVXYQIqbs7pEdXqPLVFAHC8mrcXVSg=; b=bFbKc3gikECZQSviGQs0y1uKj+LVkV0Wg3WuYg04UDC7GzXWXzmKSt7B9Z/5pUiF5l8Lwe nuLmnak/+N32IPAw== 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 3C208593AF; Tue, 21 Apr 2026 03:55:45 +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 +2K0C0H15mk2YAAAD6G6ig (envelope-from ); Tue, 21 Apr 2026 03:55:45 +0000 Date: Tue, 21 Apr 2026 05:55:35 +0200 From: Oscar Salvador To: Muchun Song Cc: Andrew Morton , David Hildenbrand , Muchun Song , Michael Ellerman , Madhavan Srinivasan , Mike Rapoport , Lorenzo Stoakes , "Liam R . Howlett" , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Nicholas Piggin , Christophe Leroy , aneesh.kumar@linux.ibm.com, joao.m.martins@oracle.com, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/4] mm/sparse-vmemmap: Pass @pgmap argument to memory deactivation paths Message-ID: References: <20260421022044.1217503-1-songmuchun@bytedance.com> <20260421022044.1217503-3-songmuchun@bytedance.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: <20260421022044.1217503-3-songmuchun@bytedance.com> X-Spamd-Result: default: False [-8.30 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ARC_NA(0.00)[]; RCPT_COUNT_TWELVE(0.00)[19]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; FREEMAIL_CC(0.00)[linux-foundation.org,kernel.org,linux.dev,ellerman.id.au,linux.ibm.com,oracle.com,google.com,suse.com,gmail.com,kvack.org,lists.ozlabs.org,vger.kernel.org]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; MISSING_XM_UA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[bytedance.com:email,localhost.localdomain:mid,imap1.dmz-prg2.suse.org:helo,suse.de:email] X-Spam-Flag: NO X-Spam-Score: -8.30 X-Spam-Level: On Tue, Apr 21, 2026 at 10:20:42AM +0800, Muchun Song wrote: > Currently, the memory hot-remove call chain -- arch_remove_memory(), > __remove_pages(), sparse_remove_section() and section_deactivate() -- > does not carry the struct dev_pagemap pointer. This prevents the lower > levels from knowing whether the section was originally populated with > vmemmap optimizations (e.g., DAX with vmemmap optimization enabled). > > Without this information, we cannot call vmemmap_can_optimize() to > determine if the vmemmap pages were optimized. As a result, the vmemmap > page accounting during teardown will mistakenly assume a non-optimized > allocation, leading to incorrect memmap statistics. > > To lay the groundwork for fixing the vmemmap page accounting, we need > to pass the @pgmap pointer down to the deactivation location. Plumb the > @pgmap argument through the APIs of arch_remove_memory(), __remove_pages() > and sparse_remove_section(), mirroring the corresponding *_activate() > paths. > > Signed-off-by: Muchun Song > Acked-by: Mike Rapoport (Microsoft) Reviewed-by: Oscar Salvador The change looks good to me, but I was wondering whether we should pass a mhp struct instead to low-level functions like arch_remove_memory and __remove_pages and have __remove_pages then pass the right stuff down the road. That way it would mimic more what we do in hot-add path. -- Oscar Salvador SUSE Labs