]> git.baikalelectronics.ru Git - kernel.git/commitdiff
powernv/memtrace: always online added memory blocks
authorDavid Hildenbrand <david@redhat.com>
Tue, 7 Apr 2020 03:07:28 +0000 (20:07 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 7 Apr 2020 17:43:40 +0000 (10:43 -0700)
Let's always try to online the re-added memory blocks.  In case
add_memory() already onlined the added memory blocks, the first
device_online() call will fail and stop processing the remaining memory
blocks.

This avoids manually having to check memhp_auto_online.

Note: PPC always onlines all hotplugged memory directly from the kernel as
well - something that is handled by user space on other architectures.

Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Baoquan He <bhe@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Yumei Huang <yuhuang@redhat.com>
Link: http://lkml.kernel.org/r/20200317104942.11178-5-david@redhat.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/powerpc/platforms/powernv/memtrace.c

index d6d64f8718e6f3369c51ba27c740934178757cad..13b369d2cc454b7b3995c1ddc191a0e0599ce7cb 100644 (file)
@@ -231,16 +231,10 @@ static int memtrace_online(void)
                        continue;
                }
 
-               /*
-                * If kernel isn't compiled with the auto online option
-                * we need to online the memory ourselves.
-                */
-               if (!memhp_auto_online) {
-                       lock_device_hotplug();
-                       walk_memory_blocks(ent->start, ent->size, NULL,
-                                          online_mem_block);
-                       unlock_device_hotplug();
-               }
+               lock_device_hotplug();
+               walk_memory_blocks(ent->start, ent->size, NULL,
+                                  online_mem_block);
+               unlock_device_hotplug();
 
                /*
                 * Memory was added successfully so clean up references to it