diff options
author | David Hildenbrand <david@redhat.com> | 2019-05-13 20:21:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-14 12:47:49 -0400 |
commit | 9d1d887d785b4fe0590bd3c5e71acaa3908044e2 (patch) | |
tree | 7a59194347b0613b2019d71ef03d22dd70ebc7f8 /mm/memory_hotplug.c | |
parent | cb7b3a3685b20d3b5900ff24b2cb96d002960189 (diff) |
mm/memory_hotplug: make __remove_section() never fail
Let's just warn in case a section is not valid instead of failing to
remove somewhere in the middle of the process, returning an error that
will be mostly ignored by callers.
Link: http://lkml.kernel.org/r/20190409100148.24703-4-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Cc: Michal Hocko <mhocko@suse.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
Cc: Qian Cai <cai@lca.pw>
Cc: Wei Yang <richard.weiyang@gmail.com>
Cc: Arun KS <arunks@codeaurora.org>
Cc: Mathieu Malaterre <malat@debian.org>
Cc: Andrew Banman <andrew.banman@hpe.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Mike Rapoport <rppt@linux.ibm.com>
Cc: Mike Travis <mike.travis@hpe.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Oscar Salvador <osalvador@suse.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Rich Felker <dalias@libc.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Stefan Agner <stefan@agner.ch>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory_hotplug.c')
-rw-r--r-- | mm/memory_hotplug.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 1f3707ab7a63..3512bba20e2b 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -516,15 +516,15 @@ static void __remove_zone(struct zone *zone, unsigned long start_pfn) | |||
516 | pgdat_resize_unlock(zone->zone_pgdat, &flags); | 516 | pgdat_resize_unlock(zone->zone_pgdat, &flags); |
517 | } | 517 | } |
518 | 518 | ||
519 | static int __remove_section(struct zone *zone, struct mem_section *ms, | 519 | static void __remove_section(struct zone *zone, struct mem_section *ms, |
520 | unsigned long map_offset, struct vmem_altmap *altmap) | 520 | unsigned long map_offset, |
521 | struct vmem_altmap *altmap) | ||
521 | { | 522 | { |
522 | unsigned long start_pfn; | 523 | unsigned long start_pfn; |
523 | int scn_nr; | 524 | int scn_nr; |
524 | int ret = -EINVAL; | ||
525 | 525 | ||
526 | if (!valid_section(ms)) | 526 | if (WARN_ON_ONCE(!valid_section(ms))) |
527 | return ret; | 527 | return; |
528 | 528 | ||
529 | unregister_memory_section(ms); | 529 | unregister_memory_section(ms); |
530 | 530 | ||
@@ -533,7 +533,6 @@ static int __remove_section(struct zone *zone, struct mem_section *ms, | |||
533 | __remove_zone(zone, start_pfn); | 533 | __remove_zone(zone, start_pfn); |
534 | 534 | ||
535 | sparse_remove_one_section(zone, ms, map_offset, altmap); | 535 | sparse_remove_one_section(zone, ms, map_offset, altmap); |
536 | return 0; | ||
537 | } | 536 | } |
538 | 537 | ||
539 | /** | 538 | /** |
@@ -553,7 +552,7 @@ int __remove_pages(struct zone *zone, unsigned long phys_start_pfn, | |||
553 | { | 552 | { |
554 | unsigned long i; | 553 | unsigned long i; |
555 | unsigned long map_offset = 0; | 554 | unsigned long map_offset = 0; |
556 | int sections_to_remove, ret = 0; | 555 | int sections_to_remove; |
557 | 556 | ||
558 | /* In the ZONE_DEVICE case device driver owns the memory region */ | 557 | /* In the ZONE_DEVICE case device driver owns the memory region */ |
559 | if (is_dev_zone(zone)) { | 558 | if (is_dev_zone(zone)) { |
@@ -574,16 +573,13 @@ int __remove_pages(struct zone *zone, unsigned long phys_start_pfn, | |||
574 | unsigned long pfn = phys_start_pfn + i*PAGES_PER_SECTION; | 573 | unsigned long pfn = phys_start_pfn + i*PAGES_PER_SECTION; |
575 | 574 | ||
576 | cond_resched(); | 575 | cond_resched(); |
577 | ret = __remove_section(zone, __pfn_to_section(pfn), map_offset, | 576 | __remove_section(zone, __pfn_to_section(pfn), map_offset, |
578 | altmap); | 577 | altmap); |
579 | map_offset = 0; | 578 | map_offset = 0; |
580 | if (ret) | ||
581 | break; | ||
582 | } | 579 | } |
583 | 580 | ||
584 | set_zone_contiguous(zone); | 581 | set_zone_contiguous(zone); |
585 | 582 | return 0; | |
586 | return ret; | ||
587 | } | 583 | } |
588 | #endif /* CONFIG_MEMORY_HOTREMOVE */ | 584 | #endif /* CONFIG_MEMORY_HOTREMOVE */ |
589 | 585 | ||