• Andrew Shewmaker's avatar
    mm: reinititalise user and admin reserves if memory is added or removed · 1640879a
    Andrew Shewmaker authored
    Alter the admin and user reserves of the previous patches in this series
    when memory is added or removed.
    
    If memory is added and the reserves have been eliminated or increased
    above the default max, then we'll trust the admin.
    
    If memory is removed and there isn't enough free memory, then we need to
    reset the reserves.
    
    Otherwise keep the reserve set by the admin.
    
    The reserve reset code is the same as the reserve initialization code.
    
    I tested hot addition and removal by triggering it via sysfs.  The
    reserves shrunk when they were set high and memory was removed.  They
    were reset higher when memory was added again.
    
    [akpm@linux-foundation.org: use register_hotmemory_notifier()]
    [akpm@linux-foundation.org: init_user_reserve() and init_admin_reserve can no longer be __meminit]
    [fengguang.wu@intel.com: make init_reserve_notifier() static]
    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: default avatarAndrew Shewmaker <agshew@gmail.com>
    Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    1640879a
mmap.c 85.3 KB