• Nigel Cunningham's avatar
    [PATCH] Speed freeing memory for suspend. · 5d5d3694
    Nigel Cunningham authored
    Here's a patch I've prepared which improves the speed at which memory is freed
    prior to suspend.  It should be a big gain for swsusp.  For suspend2, it isn't
    used much, but has shown big improvements when I set a very low image size
    limit and had memory quite full.
    
    1GB P4, 2.6.11+Suspend2 2.1.8.
    Soft image size limit set to 2MB to emulate Pavel's implementation (eat
    as much memory as we can).
    
    Without patch:
    Freed  16545 pages in  4000 jiffies = 16.16 MB/s
    Freed  83281 pages in 14060 jiffies = 23.14 MB/s
    Freed 237754 pages in 41482 jiffies = 22.39 MB/s
    
    With patch:
    Freed  52257 pages in  6700 jiffies = 30.46 MB/s
    Freed 105693 pages in 11035 jiffies = 37.41 MB/s
    Freed 239007 pages in 18284 jiffies = 51.06 MB/s
    
    With a less aggressive image size limit (200MB):
    
    Without the patch:
    Freed  14600 pages in  1749 jiffies = 32.61 MB/s (Anomolous!)
    Freed  88563 pages in 14719 jiffies = 23.50 MB/s
    Freed 205734 pages in 32389 jiffies = 24.81 MB/s
    
    With the patch:
    Freed  68252 pages in   496 jiffies = 537.52 MB/s
    Freed 116464 pages in   569 jiffies = 798.54 MB/s
    Freed 209699 pages in   705 jiffies = 1161.89 MB/s
    
    The later pages take more work to get, which accounts for the slower MB/s with
    smaller numbers of pages to free.  Without the patch, though, getting the
    easier pages also takes longer because we do a far greater number of
    invocations of shrink_all_memory in order to get the same number of pages.
    Signed-Off-By: default avatarNigel Cunningham <ncunningham@cyclades.com>
    Acked-By: default avatarPavel Machek <pavel@ucw.cz>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    5d5d3694
vmscan.c 34.6 KB