• David Hildenbrand's avatar
    powerpc/pseries/hotplug-memory: stop checking is_mem_section_removable() · ef1b51f7
    David Hildenbrand authored
    In commit 53cdc1cb ("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 51925fb3 ("powerpc/pseries:
    Implement memory hotplug remove in the kernel"), with the initial
    hotremove support of lmbs.
    Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
    Signed-off-by: default avatarAndrew 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.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    ef1b51f7
hotplug-memory.c 22.1 KB