All of lore.kernel.org
 help / color / mirror / Atom feed
From: Donet Tom <donettom@linux.ibm.com>
To: Zi Yan <ziy@nvidia.com>
Cc: Mike Rapoport <rppt@kernel.org>,
	David Hildenbrand <david@redhat.com>,
	Oscar Salvador <osalvador@suse.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	rafael@kernel.org, Danilo Krummrich <dakr@kernel.org>,
	Ritesh Harjani <ritesh.list@gmail.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Alison Schofield <alison.schofield@intel.com>,
	Yury Norov <yury.norov@gmail.com>,
	Dave Jiang <dave.jiang@intel.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] driver/base: Remove unused functions
Date: Thu, 1 May 2025 20:45:27 +0530	[thread overview]
Message-ID: <2534e3fe-cb4d-4753-a714-6d0bc8a51040@linux.ibm.com> (raw)
In-Reply-To: <0EBDDF27-E05A-43D2-834D-987D6228A516@nvidia.com>


On 5/1/25 8:38 PM, Zi Yan wrote:
> On 28 Apr 2025, at 13:03, Donet Tom wrote:
>
>> The functions register_mem_block_under_node_early and get_nid_for_pfn
>> are not used, as register_memory_blocks_under_node_early is now used
>> to register memory blocks during early boot. Therefore, these unused
>> functions have been removed.
>>
>> Signed-off-by: Donet Tom <donettom@linux.ibm.com>
>> ---
>>   drivers/base/node.c | 54 +--------------------------------------------
>>   1 file changed, 1 insertion(+), 53 deletions(-)
>>
>> diff --git a/drivers/base/node.c b/drivers/base/node.c
>> index 4869333d366d..59ec507fc97d 100644
>> --- a/drivers/base/node.c
>> +++ b/drivers/base/node.c
>> @@ -748,15 +748,6 @@ int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
>>   }
>>
>>   #ifdef CONFIG_MEMORY_HOTPLUG
>> -static int __ref get_nid_for_pfn(unsigned long pfn)
>> -{
>> -#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT
>> -	if (system_state < SYSTEM_RUNNING)
>> -		return early_pfn_to_nid(pfn);
>> -#endif
>> -	return pfn_to_nid(pfn);
>> -}
>> -
>>   static void do_register_memory_block_under_node(int nid,
>>   						struct memory_block *mem_blk,
>>   						enum meminit_context context)
>> @@ -783,46 +774,6 @@ static void do_register_memory_block_under_node(int nid,
>>   				    ret);
>>   }
>>
>> -/* register memory section under specified node if it spans that node */
>> -static int register_mem_block_under_node_early(struct memory_block *mem_blk,
>> -					       void *arg)
>> -{
>> -	unsigned long memory_block_pfns = memory_block_size_bytes() / PAGE_SIZE;
>> -	unsigned long start_pfn = section_nr_to_pfn(mem_blk->start_section_nr);
>> -	unsigned long end_pfn = start_pfn + memory_block_pfns - 1;
>> -	int nid = *(int *)arg;
>> -	unsigned long pfn;
>> -
>> -	for (pfn = start_pfn; pfn <= end_pfn; pfn++) {
>> -		int page_nid;
>> -
>> -		/*
>> -		 * memory block could have several absent sections from start.
>> -		 * skip pfn range from absent section
>> -		 */
>> -		if (!pfn_in_present_section(pfn)) {
>> -			pfn = round_down(pfn + PAGES_PER_SECTION,
>> -					 PAGES_PER_SECTION) - 1;
>> -			continue;
>> -		}
>> -
>> -		/*
>> -		 * We need to check if page belongs to nid only at the boot
>> -		 * case because node's ranges can be interleaved.
>> -		 */
>> -		page_nid = get_nid_for_pfn(pfn);
>> -		if (page_nid < 0)
>> -			continue;
>> -		if (page_nid != nid)
>> -			continue;
>> -
>> -		do_register_memory_block_under_node(nid, mem_blk, MEMINIT_EARLY);
>> -		return 0;
>> -	}
>> -	/* mem section does not span the specified node */
>> -	return 0;
>> -}
>> -
>>   /*
>>    * During hotplug we know that all pages in the memory block belong to the same
>>    * node.
>> @@ -895,10 +846,7 @@ void register_memory_blocks_under_node(int nid, unsigned long start_pfn,
>>   {
> Should this function be renamed to register_memory_blocks_under_node_hotplug
> to reflect its current implementation?

Yes, we can rename it since it will only be called during hotplug. I will add it in next version.

Thanks
Donet


>
>>   	walk_memory_blocks_func_t func;
>>
>> -	if (context == MEMINIT_HOTPLUG)
>> -		func = register_mem_block_under_node_hotplug;
>> -	else
>> -		func = register_mem_block_under_node_early;
>> +	func = register_mem_block_under_node_hotplug;
>>
>>   	walk_memory_blocks(PFN_PHYS(start_pfn), PFN_PHYS(end_pfn - start_pfn),
>>   			   (void *)&nid, func);
>> -- 
>> 2.48.1
>
> --
> Best Regards,
> Yan, Zi
>


  reply	other threads:[~2025-05-01 15:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-28 17:03 [PATCH v2 1/2] driver/base: Optimize memory block registration to reduce boot time Donet Tom
2025-04-28 17:03 ` [PATCH v2 2/2] driver/base: Remove unused functions Donet Tom
2025-04-28 21:21   ` David Hildenbrand
2025-04-29 14:07     ` Donet Tom
2025-04-30  7:48   ` Oscar Salvador
2025-05-01 13:49     ` Donet Tom
2025-05-01 15:08   ` Zi Yan
2025-05-01 15:15     ` Donet Tom [this message]
2025-04-28 21:19 ` [PATCH v2 1/2] driver/base: Optimize memory block registration to reduce boot time David Hildenbrand
2025-04-29 14:08   ` Donet Tom
2025-04-29 16:37 ` kernel test robot
2025-04-29 17:01 ` kernel test robot
2025-05-01 14:10   ` Donet Tom
2025-04-30  7:38 ` Oscar Salvador
2025-05-01 13:55   ` Donet Tom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2534e3fe-cb4d-4753-a714-6d0bc8a51040@linux.ibm.com \
    --to=donettom@linux.ibm.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=alison.schofield@intel.com \
    --cc=dakr@kernel.org \
    --cc=dave.jiang@intel.com \
    --cc=david@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=osalvador@suse.de \
    --cc=rafael@kernel.org \
    --cc=ritesh.list@gmail.com \
    --cc=rppt@kernel.org \
    --cc=yury.norov@gmail.com \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.