OpenCloudOS-Kernel/arch
David Hildenbrand ef1b51f773 powerpc/pseries/hotplug-memory: stop checking is_mem_section_removable()
In commit 53cdc1cb29 ("drivers/base/memory.c: indicate all memory blocks
as removable"), the user space interface to compute whether a memory block
can be offlined (exposed via /sys/devices/system/memory/memoryX/removable)
has effectively been deprecated.  We want to remove the leftovers of the
kernel implementation.

When offlining a memory block (mm/memory_hotplug.c:__offline_pages()),
we'll start by:
 1. Testing if it contains any holes, and reject if so
 2. Testing if pages belong to different zones, and reject if so
 3. Isolating the page range, checking if it contains any unmovable pages

Using is_mem_section_removable() before trying to offline is not only
racy, it can easily result in false positives/negatives.  Let's stop
manually checking is_mem_section_removable(), and let device_offline()
handle it completely instead.  We can remove the racy
is_mem_section_removable() implementation next.

We now take more locks (e.g., memory hotplug lock when offlining and the
zone lock when isolating), but maybe we should optimize that
implementation instead if this ever becomes a real problem (after all,
memory unplug is already an expensive operation).  We started using
is_mem_section_removable() in commit 51925fb3c5 ("powerpc/pseries:
Implement memory hotplug remove in the kernel"), with the initial
hotremove support of lmbs.

Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Baoquan He <bhe@redhat.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Link: http://lkml.kernel.org/r/20200407135416.24093-2-david@redhat.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-06-04 19:06:23 -07:00
..
alpha alpha: simplify detection of memory zone boundaries 2020-06-03 20:09:43 -07:00
arc kmap: consolidate kmap_prot definitions 2020-06-04 19:06:22 -07:00
arm kmap: consolidate kmap_prot definitions 2020-06-04 19:06:22 -07:00
arm64 mm/debug: add tests validating architecture page table helpers 2020-06-04 19:06:21 -07:00
c6x mm: free_area_init: use maximal zone PFNs rather than zone sizes 2020-06-03 20:09:43 -07:00
csky kmap: consolidate kmap_prot definitions 2020-06-04 19:06:22 -07:00
h8300 h8300: remove usage of __ARCH_USE_5LEVEL_HACK 2020-06-04 19:06:20 -07:00
hexagon hexagon: remove __ARCH_USE_5LEVEL_HACK 2020-06-04 19:06:21 -07:00
ia64 ia64: add support for folded p4d page tables 2020-06-04 19:06:21 -07:00
m68k m68k: mm: simplify detection of memory zone boundaries 2020-06-03 20:09:43 -07:00
microblaze kmap: consolidate kmap_prot definitions 2020-06-04 19:06:22 -07:00
mips kmap: consolidate kmap_prot definitions 2020-06-04 19:06:22 -07:00
nds32 kmap: consolidate kmap_prot definitions 2020-06-04 19:06:22 -07:00
nios2 nios2: add support for folded p4d page tables 2020-06-04 19:06:21 -07:00
openrisc openrisc: add support for folded p4d page tables 2020-06-04 19:06:21 -07:00
parisc parisc/kmap: remove duplicate kmap code 2020-06-04 19:06:22 -07:00
powerpc powerpc/pseries/hotplug-memory: stop checking is_mem_section_removable() 2020-06-04 19:06:23 -07:00
riscv Merge branch 'akpm' (patches from Andrew) 2020-06-03 20:24:15 -07:00
s390 mm/debug: add tests validating architecture page table helpers 2020-06-04 19:06:21 -07:00
sh sh: add support for folded p4d page tables 2020-06-04 19:06:21 -07:00
sparc kmap: consolidate kmap_prot definitions 2020-06-04 19:06:22 -07:00
um mm: free_area_init: use maximal zone PFNs rather than zone sizes 2020-06-03 20:09:43 -07:00
unicore32 unicore32: remove __ARCH_USE_5LEVEL_HACK 2020-06-04 19:06:21 -07:00
x86 kmap: consolidate kmap_prot definitions 2020-06-04 19:06:22 -07:00
xtensa arch/kmap: define kmap_atomic_prot() for all arch's 2020-06-04 19:06:22 -07:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
Kconfig scs: Remove references to asm/scs.h from core code 2020-05-18 17:47:45 +01:00