• K
    memory hotplug: unify is_removable and offline detection code · 49ac8255
    KAMEZAWA Hiroyuki 提交于
    Now, sysfs interface of memory hotplug shows whether the section is
    removable or not.  But it checks only migrateype of pages and doesn't
    check details of cluster of pages.
    
    Next, memory hotplug's set_migratetype_isolate() has the same kind of
    check, too.
    
    This patch adds the function __count_unmovable_pages() and makes above 2
    checks to use the same logic.  Then, is_removable and hotremove code uses
    the same logic.  No changes in the hotremove logic itself.
    
    TODO: need to find a way to check RECLAMABLE. But, considering bit,
          calling shrink_slab() against a range before starting memory hotremove
          sounds better. If so, this patch's logic doesn't need to be changed.
    
    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Reported-by: NMichal Hocko <mhocko@suse.cz>
    Cc: Wu Fengguang <fengguang.wu@intel.com>
    Cc: Mel Gorman <mel@csn.ul.ie>
    Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    49ac8255
memory_hotplug.c 21.8 KB