From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B21ABC27C52 for ; Wed, 5 Jun 2024 05:31:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 425C56B008A; Wed, 5 Jun 2024 01:31:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D5416B0092; Wed, 5 Jun 2024 01:31:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 29ED46B0093; Wed, 5 Jun 2024 01:31:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 0C0C46B008A for ; Wed, 5 Jun 2024 01:31:51 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 6D5E61C1746 for ; Wed, 5 Jun 2024 05:31:50 +0000 (UTC) X-FDA: 82195713180.14.F6F16BF Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf02.hostedemail.com (Postfix) with ESMTP id 28DAF80008 for ; Wed, 5 Jun 2024 05:31:46 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=EwBuqV7d; spf=pass (imf02.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717565507; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=kJC9B9NUE/dc6HGmIXC8mGwiSFBmi4iqtSNN97wffZY=; b=Aw6BdTACmH+lqEu5T4OvZoFn6F50sHvcj2CSt+q0HgGGupu45JfvdaK5XtCqQTqKpRmso8 qTMVyEZfCk5YXGR/B/JBWyuCDTO7w7MFCDCbLf53t8C4YhNJptTCc0GXaY1mWlX01n2jwp WRB8bWYzjEfwXeqFMAho+DSACLSWsRE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717565507; a=rsa-sha256; cv=none; b=FQF5Lp0DAVec9IXmpQiN19b/h0wT398muU6jbGBaZ6UwlxuvSx136QTp82YyvpslzZNXU/ ajeY5ARXp+0Rmy/OWFaRZm2sBB737COBpgkC9fCIWnnPWwLTmC55TK4kmhuS2bbyLavMNX rIIt7/HRc5uz825+8LSe/pJ1K6qM6hc= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=EwBuqV7d; spf=pass (imf02.hostedemail.com: domain of rppt@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id C6EE3CE13B7; Wed, 5 Jun 2024 05:31:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D11FAC32782; Wed, 5 Jun 2024 05:31:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717565503; bh=353h4DMpFMsU3iF2+CEBxpJTusig6VnFJH/oYClypEc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EwBuqV7dVEKRpL36TXYQ3PNW3iE66+CLS3r0kP07i/zZPqKECXLaa6ft0x9yfTKgN zHIjV9cgKTDiAXTA/OGEAWfMlZlEeVYF+Cue/qRWVAdHroTWc9+LYjCxFPyZgkHvxS PT/1uON0JffPHQUMECq2XD1nwmmvb4YO/orR/cO/SJeA+08qut1lHi/JgfJZ8nY4Rs OA9+7hXpUTc0JJwSvaZhAoiLHopBxFIk9n6U6/OaHfUtzR9K0MUkgUB/j1R3/FTSxu OYQYez64oKmwZWOrUwe+ssHSZ5Y6sutsjZiSaQGQw+mikewM7hJOe2vtEXdHXLXPep sOER0bidA2vuw== Date: Wed, 5 Jun 2024 08:29:45 +0300 From: Mike Rapoport To: Wei Yang Cc: akpm@linux-foundation.org, linux-mm@kvack.org Subject: Re: [PATCH 3/3] mm/mm_init.c: not always search next deferred_init_pfn from very beginning Message-ID: References: <20240531002613.5231-1-richard.weiyang@gmail.com> <20240531002613.5231-3-richard.weiyang@gmail.com> <20240603201611.sru3nkkcre4muuq3@master> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240603201611.sru3nkkcre4muuq3@master> X-Rspam-User: X-Stat-Signature: h3e1dq1m45ntbre9w9rt9gxordg9phm9 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 28DAF80008 X-HE-Tag: 1717565506-810915 X-HE-Meta: U2FsdGVkX19JWpExBrKrt5snVQl3K42m83pZNQI5pCYzO4jqTRhv8RnYfpvnt7aAfDniC+0NQfVY4UWmRm5dJSBTYN/aq4v6AhybxIFzdtR8kOxT7ZvXH/IRFMVArGO2SR785UjgB4r+Ofc37QaU1/cRCi1A/p68NFHBv+DtYISGMfc2merGMkGFuZZCphZHhtIImRvN0z+N1Jw0fDwaHJOCnJAq+Zkyy3+1aS8WEkUEhpM4Gd2JGTTNYgEjugY6jINMnd8ZHw9lxTmeCIIfHtTqvftNyl3UeLhOiUL1owIsP5jLuUlqD17XksABkU/pFA9mu8AjUVLZkWfBptnwSxryWLSL29mxz89JqEm7JxboUPqJwlafeC3/fCQdcDdgC49qgLHbw2WKqWH+ruxCdMRWm/u9gdEL7c/Q0d4Fzyag9yD9FX8rLbm0gP7a/+qYB6l7eCE89vk/MnOcHIc02lpi28riBQvshl5krxAPI5wc0lld316Zfaq7rsCL5MaluOmIYztbxKnntE9IFKl+YrLCqXaVFf8aMHyu0nEGwrEPlGQxHGqDJVyY2IqxFHGi/+tJke4iE754IKYTZ/v4J0VOBTvWIiepx31WVgQ7eK4EQV9bJ9xWt274K4U95vTYteOI1MBAvZ+Llq2Rcw0SDIRa/GuhZJCeGp297w43MzlttD89QH15zhkvG5BkZbJ05/SrvhKvPjuiaTtTT5mrmSTsnWAc8FPRwvEeM4uqVjVi2UkiMiDj8oZtK22WmC+ABLA69Om/6VXDnvcKiqiXcMLrcVwRqL6XSK8A4a0arvBhHJ+a02XdHyIds18EWzSj/TlsBknNxQf4BxOSsL7HsxMdX+d5PGcFUaD/dndhDzdsBwZLTgh8lFq3HhT1nRYs9um40EqhKQf9EAZUf4mls71oNbAyblJVKvQQmL09lCtzYEfMO7jQNebh8KYOpbTGBteZZBoL6qksPfK2rTZ mA5NKCW8 BGNkbDtBp2C7gFetILGASuUvbWZgnQjv/R67n6HE9K3FeBbLWTpYn6FZfe9ftaWuIYAydEp76aV7bq360CByhyvC6rmVnazcuEpEe916TgdXTMFbrqYnMRgqdRzc5ItL7K0VLpDBTEjpVtXId3KSPawbf2wCpUz7J0eL4d+7UgDNPjOP4DTz6UtKU80Jdr8xD+UmE5mnYSCLylpEkrdOIo+l3zn5VuB1avzzMb8v+kIf0IxQdtzccT89lDdw6he5QS3Y3WGYthiHWRQPhhUphXudYAhW0iM8Z3Lh8 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Mon, Jun 03, 2024 at 08:16:11PM +0000, Wei Yang wrote: > On Mon, Jun 03, 2024 at 09:27:10AM +0300, Mike Rapoport wrote: > >On Fri, May 31, 2024 at 12:26:13AM +0000, Wei Yang wrote: > >> In function deferred_init_memmap(), we call > >> deferred_init_mem_pfn_range_in_zone() to get the next deferred_init_pfn. > >> But we always search it from the very beginning. > >> > >> Since we save the index in i, we can leverage this to search from i next > >> time. > >> > >> Signed-off-by: Wei Yang > >> --- > >> include/linux/memblock.h | 19 ------------------- > >> mm/mm_init.c | 21 ++++++++++++--------- > >> 2 files changed, 12 insertions(+), 28 deletions(-) > >> > >> diff --git a/include/linux/memblock.h b/include/linux/memblock.h > >> index 6cf18dc2b4d0..45cac33334c8 100644 > >> --- a/include/linux/memblock.h > >> +++ b/include/linux/memblock.h > >> @@ -299,25 +299,6 @@ void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn, > >> void __next_mem_pfn_range_in_zone(u64 *idx, struct zone *zone, > >> unsigned long *out_spfn, > >> unsigned long *out_epfn); > >> -/** > >> - * for_each_free_mem_pfn_range_in_zone - iterate through zone specific free > >> - * memblock areas > >> - * @i: u64 used as loop variable > >> - * @zone: zone in which all of the memory blocks reside > >> - * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL > >> - * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL > >> - * > >> - * Walks over free (memory && !reserved) areas of memblock in a specific > >> - * zone. Available once memblock and an empty zone is initialized. The main > >> - * assumption is that the zone start, end, and pgdat have been associated. > >> - * This way we can use the zone to determine NUMA node, and if a given part > >> - * of the memblock is valid for the zone. > >> - */ > >> -#define for_each_free_mem_pfn_range_in_zone(i, zone, p_start, p_end) \ > >> - for (i = 0, \ > >> - __next_mem_pfn_range_in_zone(&i, zone, p_start, p_end); \ > >> - i != U64_MAX; \ > >> - __next_mem_pfn_range_in_zone(&i, zone, p_start, p_end)) > >> > >> /** > >> * for_each_free_mem_pfn_range_in_zone_from - iterate through zone specific > >> diff --git a/mm/mm_init.c b/mm/mm_init.c > >> index d05a4c38310f..ec17bf93f946 100644 > >> --- a/mm/mm_init.c > >> +++ b/mm/mm_init.c > >> @@ -2023,18 +2023,21 @@ static unsigned long __init deferred_init_pages(struct zone *zone, > >> * return false indicating there are no valid ranges left. > >> */ > >> static bool __init > >> -deferred_init_mem_pfn_range_in_zone(u64 *i, struct zone *zone, > >> +deferred_init_mem_pfn_range_in_zone_from(u64 *i, struct zone *zone, > > > >I don't think renaming this function is useful. > >The comment above it, on the other hand, needs update. > > > > Not good at the description, below is my adjustment. Does it looks good to > you? > > diff --git a/mm/mm_init.c b/mm/mm_init.c > index 1780567b5f6b..bc065728261d 100644 > --- a/mm/mm_init.c > +++ b/mm/mm_init.c > @@ -2003,13 +2003,14 @@ static unsigned long __init deferred_init_pages(struct zone *zone, > } > > /* > - * This function is meant to pre-load the iterator for the zone init. > + * This function is meant to pre-load the iterator for the zone init from a > + * given point. If it specifies to start from 0, do the initial iteration. > * Specifically it walks through the ranges until we are caught up to the > * first_init_pfn value and exits there. If we never encounter the value we > * return false indicating there are no valid ranges left. > */ I've slightly updated it: /* * This function is meant to pre-load the iterator for the zone init from * a given point. * Specifically it walks through the ranges starting with initial index * passed to it until we are caught up to the first_init_pfn value and * exits there. If we never encounter the value we return false indicating * there are no valid ranges left. */ > -- > Wei Yang > Help you, Help me -- Sincerely yours, Mike.