diff mbox series

[v1,4/5] xen/balloon: try to merge system ram resources

Message ID 20200821103431.13481-5-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 reuse 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: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Roger Pau Monné <roger.pau@citrix.com>
Cc: Julien Grall <julien@xen.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/xen/balloon.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Juergen Gross Sept. 2, 2020, 10:15 a.m. UTC | #1
On 21.08.20 12:34, David Hildenbrand wrote:
> Let's reuse 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: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Cc: Juergen Gross <jgross@suse.com>
> Cc: Stefano Stabellini <sstabellini@kernel.org>
> Cc: Roger Pau Monné <roger.pau@citrix.com>
> Cc: Julien Grall <julien@xen.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/xen/balloon.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
> index 37ffccda8bb87..5ec73f752b8a7 100644
> --- a/drivers/xen/balloon.c
> +++ b/drivers/xen/balloon.c
> @@ -338,6 +338,10 @@ static enum bp_state reserve_additional_memory(void)
>   	if (rc) {
>   		pr_warn("Cannot add additional memory (%i)\n", rc);
>   		goto err;
> +	} else {
> +		resource = NULL;
> +		/* Try to reduce the number of system ram resources. */
> +		merge_system_ram_resources(&iomem_resource);
>   	}

I don't see the need for setting resource to NULL and to use an "else"
clause here.


Juergen
David Hildenbrand Sept. 2, 2020, 10:34 a.m. UTC | #2
> Am 02.09.2020 um 12:15 schrieb Jürgen Groß <jgross@suse.com>:
> 
> On 21.08.20 12:34, David Hildenbrand wrote:
>> Let's reuse 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: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>> Cc: Juergen Gross <jgross@suse.com>
>> Cc: Stefano Stabellini <sstabellini@kernel.org>
>> Cc: Roger Pau Monné <roger.pau@citrix.com>
>> Cc: Julien Grall <julien@xen.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/xen/balloon.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>> diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
>> index 37ffccda8bb87..5ec73f752b8a7 100644
>> --- a/drivers/xen/balloon.c
>> +++ b/drivers/xen/balloon.c
>> @@ -338,6 +338,10 @@ static enum bp_state reserve_additional_memory(void)
>>      if (rc) {
>>          pr_warn("Cannot add additional memory (%i)\n", rc);
>>          goto err;
>> +    } else {
>> +        resource = NULL;
>> +        /* Try to reduce the number of system ram resources. */
>> +        merge_system_ram_resources(&iomem_resource);
>>      }
> 
> I don't see the need for setting resource to NULL and to use an "else"
> clause here.
> 

I set it to NULL because the pointer may be stale after that call - to avoid future bugs. But I can drop it.

Ack to the „else“ case.

Thanks for having a look!

> 
> Juergen
>
diff mbox series

Patch

diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 37ffccda8bb87..5ec73f752b8a7 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -338,6 +338,10 @@  static enum bp_state reserve_additional_memory(void)
 	if (rc) {
 		pr_warn("Cannot add additional memory (%i)\n", rc);
 		goto err;
+	} else {
+		resource = NULL;
+		/* Try to reduce the number of system ram resources. */
+		merge_system_ram_resources(&iomem_resource);
 	}
 
 	balloon_stats.total_pages += balloon_hotplug;