Skip to content

Commit

Permalink
powernv/memtrace: always online added memory blocks
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: Wei Yang <[email protected]>
Reviewed-by: Baoquan He <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Oscar Salvador <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Eduardo Habkost <[email protected]>
Cc: Haiyang Zhang <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: "K. Y. Srinivasan" <[email protected]>
Cc: Stephen Hemminger <[email protected]>
Cc: Vitaly Kuznetsov <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Yumei Huang <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
davidhildenbrand authored and torvalds committed Apr 7, 2020
1 parent 4dc8207 commit ed7f9fe
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions arch/powerpc/platforms/powernv/memtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ed7f9fe

Please sign in to comment.