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 D11703A9D8F for ; Tue, 21 Apr 2026 09:32:18 +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=1776763941; cv=none; b=BCgIEf+N/jSJ7YrNhxG5CunHxV8dufqxWTxjjC0GQpGvJp5p2E9bs4SoF0yCjCS4MGysrFx5Pww4U5pHcuWwF26doaV3qg01CB4DBKtUN9vh3DwVeU62It97+e2QFliLTDMUyOGSPG9LqolYBTBeb53y5zyVM5d4FdOZFdpsWfQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776763941; c=relaxed/simple; bh=JOfnPGgBy4cG1XlUkAlM3TzSSfQ4mhlP+l9Gyd+CkS8=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=HitXTfAkEPGJfN8uWhq6SJLOn7Ltu3mdijLQkv++LwEYi0glLNmrvxZqqA21VQ34eT/uhIjtfRmugqk7i/NSxboLWDPDIDzqiSre0CyAroLFmWkMrbf0zsuNmZSATiOG3be193/3XsfOrlEisMIPoB4nuj1Sdn/G7Um0hbcO4qo= 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=bF6yocuu; 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="bF6yocuu" Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1776763936; 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=H7VXEbbN0/EFAsyspDHjyOjj9f+YNV767eZ9TvCWrBw=; b=bF6yocuuZ5+0H8Fj7WvzL919cWKgFPNL8PdSdWurzXEOJq1H1pY/1J/qvHbN+HJ1tcyOns 0TRyXPw7yhE8WRPiIeS845fY2+SuhVVLrT/9htCQjcZl2S2MUjm4PP27xLcp0mCQOqZcFn wLmMzaDq8QJtPO4YC1f8nb4g+n+Pv4E= 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 4/4] mm/mm_init: Fix pageblock migratetype for ZONE_DEVICE compound pages X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: <20260421022044.1217503-5-songmuchun@bytedance.com> Date: Tue, 21 Apr 2026 17:31:36 +0800 Cc: Andrew Morton , David Hildenbrand , Oscar Salvador , 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: <67CABBD2-FA75-40D0-909D-9B6A523CCC8C@linux.dev> References: <20260421022044.1217503-1-songmuchun@bytedance.com> <20260421022044.1217503-5-songmuchun@bytedance.com> To: Muchun Song X-Migadu-Flow: FLOW_OUT > On Apr 21, 2026, at 10:20, Muchun Song = wrote: >=20 > The memmap_init_zone_device() function only initializes the = migratetype > of the first pageblock of a compound page. If the compound page size > exceeds pageblock_nr_pages (e.g., 1GB hugepages with 2MB pageblocks), > subsequent pageblocks in the compound page remain uninitialized. >=20 > Move the migratetype initialization out of __init_zone_device_page() > and into a separate pageblock_migratetype_init_range() function. This > iterates over the entire PFN range of the memory, ensuring that all > pageblocks are correctly initialized. >=20 > Fixes: c4386bd8ee3a ("mm/memremap: add ZONE_DEVICE support for = compound pages") > Signed-off-by: Muchun Song > Reviewed-by: Mike Rapoport (Microsoft) > --- > mm/mm_init.c | 43 ++++++++++++++++++++++++++++--------------- > 1 file changed, 28 insertions(+), 15 deletions(-) >=20 > diff --git a/mm/mm_init.c b/mm/mm_init.c > index f9f8e1af921c..e2d8eae23aa3 100644 > --- a/mm/mm_init.c > +++ b/mm/mm_init.c > @@ -674,6 +674,19 @@ static inline void fixup_hashdist(void) > static inline void fixup_hashdist(void) {} > #endif /* CONFIG_NUMA */ >=20 > +static __meminit void pageblock_migratetype_init_range(unsigned long = pfn, > + unsigned long nr_pages, > + int migratetype) > +{ > + unsigned long end =3D pfn + nr_pages; > + > + for (pfn =3D pageblock_align(pfn); pfn < end; pfn +=3D = pageblock_nr_pages) { > + init_pageblock_migratetype(pfn_to_page(pfn), = migratetype, false); > + if (IS_ALIGNED(pfn, PAGES_PER_SECTION)) > + cond_resched(); > + } > +} I found a positive comment from AI review: This trigger a -Wunused-function warning when CONFIG_ZONE_DEVICE is disabled. I'll fix it in the next version. Thanks.