• Viktor Rosendahl's avatar
    lowmem: get rid of the percentages · 7ad66bbe
    Viktor Rosendahl authored
    The purpose of this patch is to get rid of the lame percentage calculations in
    lowmem.c. Currently, the limits (measured in pages) are calculated from
    percentages every time somebody from userspace requests some memory. With this
    patch, the limits are in pages and furthermore, they are specified as minimum
    amount of "free pages", instead of as maximum amount of "used pages". "Free"
    means free pages or such pages that can easily be freed by the VM system.
    
    This patch changes the names of the lowmem sysctl limits in /proc/sys/vm:
    lowmem_deny_watermark  	     => lowmem_deny_watermark_pages
    lowmem_notify_low	     => lowmem_notify_low_pages
    lowmem_notify_high 	     => lowmem_notify_high_pages
    
    The following read only value disappears:
    lowmem_used_pages
    
    The following read only value is introduced:
    lowmem_free_pages
    
    The old value can be calculated from userspace with the following pseudocode:
    
    if lowmem_free_pages < lowmem_allowed_pages
       lowmem_used_pages = lowmem_allowed_pages - lowmem_free_pages
    else
       lowmem_used_pages = 0;
    
    Note that the value of lowmem_free_pages is only accurate when the system is
    rather low on memory (otherwise it's a bit too pessimistic), this was true also
    for the lowmem_used_pages metric.
    Signed-off-by: default avatarViktor Rosendahl <viktor.rosendahl@nokia.com>
    Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
    7ad66bbe
lowmem.c 8.16 KB