From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [91.218.175.189]) (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 53025312837 for ; Tue, 14 Apr 2026 03:00:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776135649; cv=none; b=WXZNfcDu65wXVSK+6Z+52JCC3nVqKwEcGwI5/YffwssJqNDskeTlzoJQfo36hpic+i4RW8mwUxphGIWhzBRsEo0cTMvrD5MM8HDkZR6xQ6IDKjRj5k9GMt2c0vl6mUN8bUkqSWC2nxjbTrYwaH5vySl/0kciEgJ/ZbtwmSGUeT4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776135649; c=relaxed/simple; bh=4PlymUBRhoew3U1NTZK8jxRqafzc24WW3+boeDt4A/A=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=bBQafhllbsbJoiP7j378k8oVZOyh+1cOss8pClCx0SZlLY/qE6d4+Rux/EtO+Ywvmo1WcZppv6FdsedlcSGSoMPs1fjzCT9vwzRJkge4M+O1an2UFEgyGT7iv/uPWkLCJaUQKpP3sQVitYAOOSd8P0rXoNlBjYg34Z04COdpHhA= 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=iRwDPzSZ; arc=none smtp.client-ip=91.218.175.189 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="iRwDPzSZ" Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1776135645; 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=4PlymUBRhoew3U1NTZK8jxRqafzc24WW3+boeDt4A/A=; b=iRwDPzSZORBKkVc+qfAjdg/8sbprXX/S91NOZEjG9sY6nLhmM/7OkcH+FVVdFyPabDclFz MyQpXLhsvkEGbaqai+jaUp2+HVQNmnygABaq8U07zcHezNt3L9GnLd10HMAFhExFPzc9PE rVlGd2hYbvT3N41tMq1mKLtf4kVK3BE= 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 07/49] mm/mm_init: use pageblock_migratetype_init_range() in deferred_free_pages() X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: <08a82aa4-f556-4e0f-9e50-b9fe0a5fb4c1@kernel.org> Date: Tue, 14 Apr 2026 11:00:00 +0800 Cc: Muchun Song , Andrew Morton , Oscar Salvador , Michael Ellerman , Madhavan Srinivasan , Lorenzo Stoakes , "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , 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: <3FDA057D-EBFA-4016-8555-E046FA161984@linux.dev> References: <20260405125240.2558577-1-songmuchun@bytedance.com> <20260405125240.2558577-8-songmuchun@bytedance.com> <08a82aa4-f556-4e0f-9e50-b9fe0a5fb4c1@kernel.org> To: "David Hildenbrand (Arm)" X-Migadu-Flow: FLOW_OUT > On Apr 14, 2026, at 02:54, David Hildenbrand (Arm) = wrote: >=20 > On 4/5/26 14:51, Muchun Song wrote: >> Simplify deferred_free_pages by replacing the duplicate loops for >> initializing pageblock migratetype with a call to >> pageblock_migratetype_init_range to simplify the code. >=20 > "Simplify ... to simplify the code." >=20 > Likely you can drop the last part. OK. I'll rewrite the message. >=20 >>=20 >> Signed-off-by: Muchun Song >> --- >> mm/mm_init.c | 13 ++++--------- >> 1 file changed, 4 insertions(+), 9 deletions(-) >>=20 >> diff --git a/mm/mm_init.c b/mm/mm_init.c >> index 4936ca78966c..a92c5053f63d 100644 >> --- a/mm/mm_init.c >> +++ b/mm/mm_init.c >> @@ -1974,13 +1974,12 @@ static void __init = deferred_free_pages(unsigned long pfn, >> if (!nr_pages) >> return; >>=20 >> + pageblock_migratetype_init_range(pfn, nr_pages, MIGRATE_MOVABLE); >=20 >=20 > pageblock_migratetype_init_range() will align the PFN up to the next > pageblock. IIUC, pageblock_align(pfn) is to **round up** PFN to the next multiple = of pageblock_nr_pages. >=20 > Are we sure the range we are getting called with is always aligned to > pageblocks, such that we won't miss to initialize the first pageblock? That means if pageblock_aligned(pfn) =3D=3D 1, then the result of pageblock_align(pfn) is the pfn itself. So there is no problem as you said. Thanks, Muchun. >=20 > --=20 > Cheers, >=20 > David