From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-177.mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D946A40DFBB for ; Tue, 21 Apr 2026 04:02:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776744148; cv=none; b=BgwqZH4xQridUvbQ/0sYWS1pCLnHjiswaFGHQw956G2e1xDhoLL/idaBzFUpzIHd+VbXZGrax/HTiWKihxnLsv87uvSzRfdrybraL1SwZzGhEo84gUruKgClYdlEm4LyqSYLfuFB27m9h3VxN57ZanrUu9gOSg4VJ3MYobs1MnA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776744148; c=relaxed/simple; bh=jMdJRNtKo7iaVl+CsUGo+lqElncIkwLhNwFqakkkUeM=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=rO36E3i/raQpvBZ06YoHs6MRdomcX4kucih6qat9WMd5AbCV+qs4dCScAhfojt+9MSiT9m7obC++FryePpY9IuFqxRSO1tHGhnDM2AvQGOq/uXsOBqFxh1feRa9C929geUjIilm6J1TVIsBkZ/Xuo09PhKkxCS5O6KR94JxsMhQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=P0xaSkgf; arc=none smtp.client-ip=91.218.175.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="P0xaSkgf" Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1776744143; h=from:from: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; bh=jMdJRNtKo7iaVl+CsUGo+lqElncIkwLhNwFqakkkUeM=; b=P0xaSkgffkY/VRF9fMqKDRh7+V+gLrQC2wIjEZ6WMNXTbB4slbAyJZcsfbYpBc8bue41Gs uC++PiG4GNvn5/ExS0vNS0mVz2zXeeQ1kIUJ7wtddJaMO0GIWpx0gQHOLUqaQ7IjZOyY0b cV6Lg9OsFyqR52slTe7DWhNESR/Rq/0= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.500.181\)) Subject: Re: [PATCH v3 2/4] mm/sparse-vmemmap: Pass @pgmap argument to memory deactivation paths X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: Date: Tue, 21 Apr 2026 12:01:42 +0800 Cc: Muchun Song , Andrew Morton , David Hildenbrand , 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 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20260421022044.1217503-1-songmuchun@bytedance.com> <20260421022044.1217503-3-songmuchun@bytedance.com> To: Oscar Salvador X-Migadu-Flow: FLOW_OUT > On Apr 21, 2026, at 11:55, Oscar Salvador wrote: >=20 > 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). >>=20 >> 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. >>=20 >> 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. >>=20 >> Signed-off-by: Muchun Song >> Acked-by: Mike Rapoport (Microsoft) >=20 > Reviewed-by: Oscar Salvador Thanks. >=20 > 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. Passing the pgmap parameter is a temporary fix, as I have another patchset coming up to remove pgmap entirely [1]. [1] = https://lore.kernel.org/linux-mm/20260405125240.2558577-46-songmuchun@byte= dance.com/ Thanks, Muchun. >=20 >=20 > --=20 > Oscar Salvador > SUSE Labs