• David Hildenbrand's avatar
    drivers/base/memory.c: drop section_count · 68c3a6ac
    David Hildenbrand authored
    Patch series "mm: drop superfluous section checks when onlining/offlining".
    
    Let's drop some superfluous section checks on the onlining/offlining path.
    
    This patch (of 3):
    
    Since commit c5e79ef5 ("mm/memory_hotplug.c: don't allow to
    online/offline memory blocks with holes") we have a generic check in
    offline_pages() that disallows offlining memory blocks with holes.
    
    Memory blocks with missing sections are just another variant of these type
    of blocks.  We can stop checking (and especially storing) present
    sections.  A proper error message is now printed why offlining failed.
    
    section_count was initially introduced in commit 07681215 ("Driver
    core: Add section count to memory_block struct") in order to detect when
    it is okay to remove a memory block.  It was used in commit 26bbe7ef
    ("drivers/base/memory.c: prohibit offlining of memory blocks with missing
    sections") to disallow offlining memory blocks with missing sections.  As
    we refactored creation/removal of memory devices and have a proper check
    for holes in place, we can drop the section_count.
    
    This also removes a leftover comment regarding the mem_sysfs_mutex, which
    was removed in commit 848e19ad ("drivers/base/memory.c: drop the
    mem_sysfs_mutex").
    Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: "Rafael J. Wysocki" <rafael@kernel.org>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
    Cc: Anshuman Khandual <anshuman.khandual@arm.com>
    Link: http://lkml.kernel.org/r/20200127110424.5757-2-david@redhat.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    68c3a6ac
memory.c 21.2 KB