From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-180.mta1.migadu.com (out-180.mta1.migadu.com [95.215.58.180]) (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 BB8351D516C for ; Tue, 14 Apr 2026 03:04:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776135894; cv=none; b=L6iEixdKYnauaW4D/yIsTyYpbL7brGbPAAt9Uagewgu1Wt+z/l22gPiGK17OEK9fi/Gwg91R/E07dO8nqDFVU936D36b4vnnuXFzV9Ofnul0qw8MTqLlEdjZZjPSBvJKOJ5/iRlt98U8/m5EFOz1Fa14iYWTEJKcOEfkuZS9vZ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776135894; c=relaxed/simple; bh=AhGWS3QGBplo+4j3OwxsSsasD6/s/ktf08HiBlbn8Wg=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=K6p8N7yybh9M+lUMD7GxdGbgi5zs/+4L/hJOjRQK1G5uJcmF+fzwoCFDdiC3s6rnB4KFvlH7fhNnCfLI0ZK1V4bTRW3f+W3gVzRuWjEcEG+6Z2KUvWouqG0mJbqSy9pN/Otqwuef/Wsg3lNl/IbavYMV0p+8kZwgaSxsxwTyHEg= 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=BWCLoDKy; arc=none smtp.client-ip=95.215.58.180 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="BWCLoDKy" Content-Type: text/plain; charset=utf-8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1776135890; 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=3FYu2CGFYAk0qz0gN9Zhq63kXcX9UNvQTBocmoERSRo=; b=BWCLoDKyxBJFi3Ak8GVKAz3mczB5fhYPqbcTIn1JLJPdaRGKuULfEgReV+W36aXs54UIbv N6iKcqxl/Jq+Aytf+mV9Vw3DB8IDAjq24brNkTJwfYetGa4OJz2ESJjTkIKKipP/I2cSLQ nvwBpt3fEMn40XHMClXyUhbDujjNcsk= 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 06/49] mm/mm_init: fix uninitialized 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: <42ba7f13-846f-4150-8195-32a775bb6812@kernel.org> Date: Tue, 14 Apr 2026 11:04:13 +0800 Cc: Mike Rapoport , Muchun Song , Andrew Morton , Oscar Salvador , Michael Ellerman , Madhavan Srinivasan , 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: <42ba7f13-846f-4150-8195-32a775bb6812@kernel.org> To: "David Hildenbrand (Arm)" X-Migadu-Flow: FLOW_OUT > On Apr 14, 2026, at 02:50, David Hildenbrand (Arm) = wrote: >=20 > On 4/13/26 15:57, Muchun Song wrote: >>=20 >>=20 >>> On Apr 13, 2026, at 21:28, Mike Rapoport wrote: >>>=20 >>> =EF=BB=BFOn Mon, Apr 13, 2026 at 06:07:44PM +0800, Muchun Song = wrote: >>>>=20 >>>>=20 >>>>=20 >>>> Of course not. >>>>=20 >>>>=20 >>>> There are indeed many more cond_resched() than before, but I = don=E2=80=99t have a >>>> concise way to write it, so I took the easy way out. >>>>=20 >>>> How about: >>>>=20 >>>> diff --git a/mm/mm_init.c b/mm/mm_init.c >>>> index 2d680636b67a..d13a2577c4c3 100644 >>>> --- a/mm/mm_init.c >>>> +++ b/mm/mm_init.c >>>> @@ -683,7 +683,8 @@ static __meminit void = pageblock_migratetype_init_range(unsigned long pfn, >>>>=20 >>>> for (pfn =3D pageblock_align(pfn); pfn < end; pfn +=3D = pageblock_nr_pages) { >>>> init_pageblock_migratetype(pfn_to_page(pfn), = migratetype, isolate); >>>> - cond_resched(); >>>> + if ((pfn & (pageblock_nr_pages * 512 - 1)) =3D=3D = 0) >>>> + cond_resched(); >>>=20 >>> TBH, I don't know if 512 is the right number :) >>=20 >> I picked this number out of thin air. I=E2=80=99m not sure as well. >>=20 >>>=20 >>> pageblock boundary was a convenient point to have cond_resched() = along with >>> setting the migrate type. >>>=20 >>> Here we might be able to squeeze more iterations between subsequent >>> cond_resched() calls. >>=20 >> Choosing an appropriate number is indeed difficult. We need to = consider >> both unnecessary cond_resched() calls and scheduling latency, and the >> specific value also depends on the current CPU performance. At the = very least, >> I find it hard to choose a correct value. Since we all agree it = should be larger >> than 512, why not just pick 1024? I can't think of a good evaluation = criterion >> or selection method either. >=20 > I think in some other code we just use section boundaries. It is a good suggestion. I'll do that. Thanks. >=20 > --=20 > Cheers, >=20 > David