diff mbox series

[v1,5/5] hv_balloon: try to merge system ram resources

Message ID 20200821103431.13481-6-david@redhat.com (mailing list archive)
State Superseded
Headers show
Series mm/memory_hotplug: selective merging of system ram resources | expand

Commit Message

David Hildenbrand Aug. 21, 2020, 10:34 a.m. UTC
Let's use the new mechanism to merge system ram resources below the
root. We are the only one hotplugging system ram, e.g., DIMMs don't apply,
so this is safe to be used.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Wei Yang <richardw.yang@linux.intel.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 drivers/hv/hv_balloon.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Wei Liu Sept. 4, 2020, 5:30 p.m. UTC | #1
On Fri, Aug 21, 2020 at 12:34:31PM +0200, David Hildenbrand wrote:
> Let's use the new mechanism to merge system ram resources below the
> root. We are the only one hotplugging system ram, e.g., DIMMs don't apply,
> so this is safe to be used.
> 
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: "K. Y. Srinivasan" <kys@microsoft.com>
> Cc: Haiyang Zhang <haiyangz@microsoft.com>
> Cc: Stephen Hemminger <sthemmin@microsoft.com>
> Cc: Wei Liu <wei.liu@kernel.org>
> Cc: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
> Cc: Baoquan He <bhe@redhat.com>
> Cc: Wei Yang <richardw.yang@linux.intel.com>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  drivers/hv/hv_balloon.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
> index 32e3bc0aa665a..49a6305f0fb73 100644
> --- a/drivers/hv/hv_balloon.c
> +++ b/drivers/hv/hv_balloon.c
> @@ -745,6 +745,9 @@ static void hv_mem_hot_add(unsigned long start, unsigned long size,
>  			has->covered_end_pfn -=  processed_pfn;
>  			spin_unlock_irqrestore(&dm_device.ha_lock, flags);
>  			break;
> +		} else {
> +			/* Try to reduce the number of system ram resources. */
> +			merge_system_ram_resources(&iomem_resource);
>  		}

You don't need to put the call under the "else" branch. It will have
broken out of the loop if ret is not zero.

Wei.

>  
>  		/*
> -- 
> 2.26.2
>
David Hildenbrand Sept. 8, 2020, 10:26 a.m. UTC | #2
On 04.09.20 19:30, Wei Liu wrote:
> On Fri, Aug 21, 2020 at 12:34:31PM +0200, David Hildenbrand wrote:
>> Let's use the new mechanism to merge system ram resources below the
>> root. We are the only one hotplugging system ram, e.g., DIMMs don't apply,
>> so this is safe to be used.
>>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: Michal Hocko <mhocko@suse.com>
>> Cc: "K. Y. Srinivasan" <kys@microsoft.com>
>> Cc: Haiyang Zhang <haiyangz@microsoft.com>
>> Cc: Stephen Hemminger <sthemmin@microsoft.com>
>> Cc: Wei Liu <wei.liu@kernel.org>
>> Cc: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
>> Cc: Baoquan He <bhe@redhat.com>
>> Cc: Wei Yang <richardw.yang@linux.intel.com>
>> Signed-off-by: David Hildenbrand <david@redhat.com>
>> ---
>>  drivers/hv/hv_balloon.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
>> index 32e3bc0aa665a..49a6305f0fb73 100644
>> --- a/drivers/hv/hv_balloon.c
>> +++ b/drivers/hv/hv_balloon.c
>> @@ -745,6 +745,9 @@ static void hv_mem_hot_add(unsigned long start, unsigned long size,
>>  			has->covered_end_pfn -=  processed_pfn;
>>  			spin_unlock_irqrestore(&dm_device.ha_lock, flags);
>>  			break;
>> +		} else {
>> +			/* Try to reduce the number of system ram resources. */
>> +			merge_system_ram_resources(&iomem_resource);
>>  		}
> 
> You don't need to put the call under the "else" branch. It will have
> broken out of the loop if ret is not zero.
> 

Agreed, thanks!
diff mbox series

Patch

diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index 32e3bc0aa665a..49a6305f0fb73 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -745,6 +745,9 @@  static void hv_mem_hot_add(unsigned long start, unsigned long size,
 			has->covered_end_pfn -=  processed_pfn;
 			spin_unlock_irqrestore(&dm_device.ha_lock, flags);
 			break;
+		} else {
+			/* Try to reduce the number of system ram resources. */
+			merge_system_ram_resources(&iomem_resource);
 		}
 
 		/*