mm/memory_hotplug: drop "online" parameter from add_memory_resource()
Subsystems (3)
PATCH 1/1 mm/memory_hotplug: drop "online" parameter from add_memory_resource()
User space should always be in charge of how to online memory and if memory should be onlined automatically in the kernel. Let's drop the parameter to overwrite this - XEN passes memhp_auto_online, just like add_memory(), so we can directly use that instead internally.
--- drivers/xen/balloon.c | 2 +- include/linux/memory_hotplug.h | 2 +- mm/memory_hotplug.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/xen/balloon.c +1 -1
@@ -397,7 +397,7 @@ static enum bp_state reserve_additional_memory(void)mutex_unlock (&balloon_mutex);/* add_memory_resource() requires the device_hotplug lock */ lock_device_hotplug (); - rc =add_memory_resource (nid, resource, memhp_auto_online); + rc =add_memory_resource (nid, resource);unlock_device_hotplug ();mutex_lock (&balloon_mutex);
include/linux/memory_hotplug.h +1 -1
@@ -326,7 +326,7 @@ extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn, void *arg, int (*func)(struct memory_block *, void *));extern int __add_memory (int nid,u64 start,u64 size);extern int add_memory (int nid,u64 start,u64 size); -extern int add_memory_resource (int nid,struct resource *resource,bool online); +extern int add_memory_resource (int nid,struct resource *resource);extern int arch_add_memory (int nid,u64 start,u64 size,struct vmem_altmap *altmap,bool want_memblock); extern void move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn,
mm/memory_hotplug.c +3 -3
@@ -1096,7 +1096,7 @@ static int online_memory_block(struct memory_block *mem, void *arg)* * we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */ -int __ref add_memory_resource (int nid,struct resource *res,bool online) +int __ref add_memory_resource (int nid,struct resource *res) {u64 start, size;bool new_node = false;
@@ -1151,7 +1151,7 @@ int __ref add_memory_resource(int nid, struct resource *res, bool online)mem_hotplug_done ();/* online pages if requested */ -if (online) +if (memhp_auto_online)walk_memory_range (PFN_DOWN (start),PFN_UP (start + size -1 ),NULL , online_memory_block);
@@ -1175,7 +1175,7 @@ int __ref __add_memory(int nid, u64 start, u64 size)if (IS_ERR (res))return PTR_ERR (res); - ret =add_memory_resource (nid, res, memhp_auto_online); + ret =add_memory_resource (nid, res);if (ret <0 )release_memory_resource (res);return ret;
Signature · 1 line
2.17.2
Quoted 4 lines · David Hildenbrand
User space should always be in charge of how to online memory and if memory should be onlined automatically in the kernel. Let's drop the parameter to overwrite this - XEN passes
memhp_auto_online, just likeadd_memory(), so we can directly use that instead internally.
Heh, I wanted to get rid of memhp_auto_online so much and now we have it in the core memory_hotplug. Not a win on my side I would say :/ On the other hand this can be seen as a cleanup because it removes that ambiguity that some callers might be unaware of the memhp_auto_online leading to a different behavior.
Quoted 6 lines
Cc Boris Ostrovsky <[email protected]>Cc Juergen Gross <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Andrew Morton <[email protected]>Cc Dan Williams <[email protected]>Cc Oscar Salvador <[email protected]>
Quoted 8 lines
Cc Pavel Tatashin <[email protected]>Cc Michal Hocko <[email protected]>Cc David Hildenbrand <[email protected]>Cc Joonsoo Kim <[email protected]>Cc Arun KS <[email protected]>Cc Mathieu Malaterre <[email protected]>Cc Stephen Rothwell <[email protected]>Signed-off-by David Hildenbrand <[email protected]>
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 8 lines · Michal Hocko
Quoted 4 lines · David Hildenbrand
User space should always be in charge of how to online memory and if memory should be onlined automatically in the kernel. Let's drop the parameter to overwrite this - XEN passes
memhp_auto_online, just likeadd_memory(), so we can directly use that instead internally.Heh, I wanted to get rid of
memhp_auto_onlineso much and now we have it in the corememory_hotplug. Not a win on my side I would say :/
That is actually a good point: Can we remove memhp_auto_online or is it already some sort of kernel ABI?
(as it is exported via /sys/devices/system/memory/auto_online_blocks)
Quoted 3 lines
On the other hand this can be seen as a cleanup because it removes that ambiguity that some callers might be unaware of the
memhp_auto_onlineleading to a different behavior.
I would say this patch is a step into the right direction - remove the flag from the interfaces, then drop it (eventually, as stated not sure if that train has left the station).
Quoted 18 lines
Quoted 15 lines
Cc Boris Ostrovsky <[email protected]>Cc Juergen Gross <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Andrew Morton <[email protected]>Cc Dan Williams <[email protected]>Cc Oscar Salvador <[email protected]>Cc Pavel Tatashin <[email protected]>Cc Michal Hocko <[email protected]>Cc David Hildenbrand <[email protected]>Cc Joonsoo Kim <[email protected]>Cc Arun KS <[email protected]>Cc Mathieu Malaterre <[email protected]>Cc Stephen Rothwell <[email protected]>Signed-off-by David Hildenbrand <[email protected]>Acked-by Michal Hocko <[email protected]>
Signature · 3 lines
Thanks, David / dhildenb
Quoted 7 lines · David Hildenbrand
Quoted 6 lines · Michal Hocko
Quoted 4 lines · David Hildenbrand
User space should always be in charge of how to online memory and if memory should be onlined automatically in the kernel. Let's drop the parameter to overwrite this - XEN passes
memhp_auto_online, just likeadd_memory(), so we can directly use that instead internally.
Quoted 7 lines
Quoted 2 lines
Heh, I wanted to get rid of
memhp_auto_onlineso much and now we have it in the corememory_hotplug. Not a win on my side I would say :/That is actually a good point: Can we remove
memhp_auto_onlineor is it already some sort of kernel ABI?(as it is exported via
/sys/devices/system/memory/auto_online_blocks)
I have tried and there was a pushback [1]. That led to a rework of the sysfs semantic of onlining btw. The biggest objection against removing was that the userspace might be too slow to online memory and memmaps could eat the available memory and trigger OOM. That is why I've started working on the self hosted memmpas but failed to finish it. Fortunatelly Oscar is brave enough to continue in that work.
[1] http://lkml.kernel.org/r/[email protected]
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 14 lines · Michal Hocko
Quoted 13 lines · David Hildenbrand
Quoted 8 lines · Michal Hocko
Quoted 4 lines · David Hildenbrand
User space should always be in charge of how to online memory and if memory should be onlined automatically in the kernel. Let's drop the parameter to overwrite this - XEN passes
memhp_auto_online, just likeadd_memory(), so we can directly use that instead internally.Heh, I wanted to get rid of
memhp_auto_onlineso much and now we have it in the corememory_hotplug. Not a win on my side I would say :/That is actually a good point: Can we remove
memhp_auto_onlineor is it already some sort of kernel ABI?
Quoted 8 lines
Quoted 1 line
(as it is exported via
/sys/devices/system/memory/auto_online_blocks)I have tried and there was a pushback [1]. That led to a rework of the sysfs semantic of onlining btw. The biggest objection against removing was that the userspace might be too slow to online memory and memmaps could eat the available memory and trigger OOM. That is why I've started working on the self hosted memmpas but failed to finish it. Fortunatelly Oscar is brave enough to continue in that work.
Yes I saw that work :) . I wonder if it is really an issue or can we worked around. At least for paravirtualized devices (a.k.a. balloon devices) - even without the memmaps rework.
E.g. only add a new memory block in case the old one was onlined. And we get that information via register_memory_notifier(). So we would always only have one memory block "pending to be onlined".
That's at least my plan for virtio-mem (add one block at a time). The problem is if some external entity triggers memory hotplug of actual devices you cannot simply control. Like adding a bunch of ACPI DIMMs in one shot without userspace being able to keep up.
But the memmaps thingy still is very valuable when wanting to add memory in an environment where we are already low on memory.
Quoted 3 lines
Signature · 3 lines
Thanks, David / dhildenb
Quoted 14 lines · Michal Hocko
Quoted 13 lines · David Hildenbrand
Quoted 8 lines · Michal Hocko
Quoted 4 lines · David Hildenbrand
User space should always be in charge of how to online memory and if memory should be onlined automatically in the kernel. Let's drop the parameter to overwrite this - XEN passes
memhp_auto_online, just likeadd_memory(), so we can directly use that instead internally.Heh, I wanted to get rid of
memhp_auto_onlineso much and now we have it in the corememory_hotplug. Not a win on my side I would say :/That is actually a good point: Can we remove
memhp_auto_onlineor is it already some sort of kernel ABI?
Quoted 8 lines
Quoted 1 line
(as it is exported via
/sys/devices/system/memory/auto_online_blocks)I have tried and there was a pushback [1]. That led to a rework of the sysfs semantic of onlining btw. The biggest objection against removing was that the userspace might be too slow to online memory and memmaps could eat the available memory and trigger OOM. That is why I've started working on the self hosted memmpas but failed to finish it. Fortunatelly Oscar is brave enough to continue in that work.
Yes I saw that work :) . I wonder if it is really an issue or can we worked around. At least for paravirtualized devices (a.k.a. balloon devices) - even without the memmaps rework.
E.g. only add a new memory block in case the old one was onlined. And we get that information via register_memory_notifier(). So we would always only have one memory block "pending to be onlined".
That's at least my plan for virtio-mem (add one block at a time). The problem is if some external entity triggers memory hotplug of actual devices you cannot simply control. Like adding a bunch of ACPI DIMMs in one shot without userspace being able to keep up.
But the memmaps thingy still is very valuable when wanting to add memory in an environment where we are already low on memory.
Quoted 3 lines
Signature · 8 lines
Thanks, David / dhildenb _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 7 lines · David Hildenbrand
Quoted 6 lines · Michal Hocko
Quoted 4 lines · David Hildenbrand
User space should always be in charge of how to online memory and if memory should be onlined automatically in the kernel. Let's drop the parameter to overwrite this - XEN passes
memhp_auto_online, just likeadd_memory(), so we can directly use that instead internally.
Quoted 7 lines
Quoted 2 lines
Heh, I wanted to get rid of
memhp_auto_onlineso much and now we have it in the corememory_hotplug. Not a win on my side I would say :/That is actually a good point: Can we remove
memhp_auto_onlineor is it already some sort of kernel ABI?(as it is exported via
/sys/devices/system/memory/auto_online_blocks)
I have tried and there was a pushback [1]. That led to a rework of the sysfs semantic of onlining btw. The biggest objection against removing was that the userspace might be too slow to online memory and memmaps could eat the available memory and trigger OOM. That is why I've started working on the self hosted memmpas but failed to finish it. Fortunatelly Oscar is brave enough to continue in that work.
[1] http://lkml.kernel.org/r/[email protected]
Signature · 7 lines
Michal Hocko SUSE Labs _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 8 lines · Michal Hocko
Quoted 4 lines · David Hildenbrand
User space should always be in charge of how to online memory and if memory should be onlined automatically in the kernel. Let's drop the parameter to overwrite this - XEN passes
memhp_auto_online, just likeadd_memory(), so we can directly use that instead internally.Heh, I wanted to get rid of
memhp_auto_onlineso much and now we have it in the corememory_hotplug. Not a win on my side I would say :/
That is actually a good point: Can we remove memhp_auto_online or is it already some sort of kernel ABI?
(as it is exported via /sys/devices/system/memory/auto_online_blocks)
Quoted 3 lines
On the other hand this can be seen as a cleanup because it removes that ambiguity that some callers might be unaware of the
memhp_auto_onlineleading to a different behavior.
I would say this patch is a step into the right direction - remove the flag from the interfaces, then drop it (eventually, as stated not sure if that train has left the station).
Quoted 18 lines
Quoted 15 lines
Cc Boris Ostrovsky <[email protected]>Cc Juergen Gross <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Andrew Morton <[email protected]>Cc Dan Williams <[email protected]>Cc Oscar Salvador <[email protected]>Cc Pavel Tatashin <[email protected]>Cc Michal Hocko <[email protected]>Cc David Hildenbrand <[email protected]>Cc Joonsoo Kim <[email protected]>Cc Arun KS <[email protected]>Cc Mathieu Malaterre <[email protected]>Cc Stephen Rothwell <[email protected]>Signed-off-by David Hildenbrand <[email protected]>Acked-by Michal Hocko <[email protected]>
Signature · 8 lines
Thanks, David / dhildenb _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 4 lines · David Hildenbrand
User space should always be in charge of how to online memory and if memory should be onlined automatically in the kernel. Let's drop the parameter to overwrite this - XEN passes
memhp_auto_online, just likeadd_memory(), so we can directly use that instead internally.
Heh, I wanted to get rid of memhp_auto_online so much and now we have it in the core memory_hotplug. Not a win on my side I would say :/ On the other hand this can be seen as a cleanup because it removes that ambiguity that some callers might be unaware of the memhp_auto_online leading to a different behavior.
Quoted 6 lines
Cc Boris Ostrovsky <[email protected]>Cc Juergen Gross <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Andrew Morton <[email protected]>Cc Dan Williams <[email protected]>Cc Oscar Salvador <[email protected]>
Quoted 8 lines
Cc Pavel Tatashin <[email protected]>Cc Michal Hocko <[email protected]>Cc David Hildenbrand <[email protected]>Cc Joonsoo Kim <[email protected]>Cc Arun KS <[email protected]>Cc Mathieu Malaterre <[email protected]>Cc Stephen Rothwell <[email protected]>Signed-off-by David Hildenbrand <[email protected]>
Signature · 7 lines
Michal Hocko SUSE Labs _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 1 line · David Hildenbrand
Signed-off-by David Hildenbrand <[email protected]>
Thanks ;-)
Signature · 2 lines
Oscar Salvador SUSE L3
Quoted 1 line · David Hildenbrand
Signed-off-by David Hildenbrand <[email protected]>
Thanks ;-)
Signature · 7 lines
Oscar Salvador SUSE L3 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 5 lines · David Hildenbrand
User space should always be in charge of how to online memory and if memory should be onlined automatically in the kernel. Let's drop the parameter to overwrite this - XEN passes
memhp_auto_online, just likeadd_memory(), so we can directly use that instead internally.
Quoted 14 lines
Cc Boris Ostrovsky <[email protected]>Cc Juergen Gross <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Andrew Morton <[email protected]>Cc Dan Williams <[email protected]>Cc Oscar Salvador <[email protected]>Cc Pavel Tatashin <[email protected]>Cc Michal Hocko <[email protected]>Cc David Hildenbrand <[email protected]>Cc Joonsoo Kim <[email protected]>Cc Arun KS <[email protected]>Cc Mathieu Malaterre <[email protected]>Cc Stephen Rothwell <[email protected]>Signed-off-by David Hildenbrand <[email protected]>
Juergen
Quoted 5 lines · David Hildenbrand
User space should always be in charge of how to online memory and if memory should be onlined automatically in the kernel. Let's drop the parameter to overwrite this - XEN passes
memhp_auto_online, just likeadd_memory(), so we can directly use that instead internally.
Quoted 14 lines
Cc Boris Ostrovsky <[email protected]>Cc Juergen Gross <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Andrew Morton <[email protected]>Cc Dan Williams <[email protected]>Cc Oscar Salvador <[email protected]>Cc Pavel Tatashin <[email protected]>Cc Michal Hocko <[email protected]>Cc David Hildenbrand <[email protected]>Cc Joonsoo Kim <[email protected]>Cc Arun KS <[email protected]>Cc Mathieu Malaterre <[email protected]>Cc Stephen Rothwell <[email protected]>Signed-off-by David Hildenbrand <[email protected]>
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel