• Hisashi Hifumi's avatar
    mm: use pagevec to rotate reclaimable page · 902aaed0
    Hisashi Hifumi authored
    While running some memory intensive load, system response deteriorated just
    after swap-out started.
    
    The cause of this problem is that when a PG_reclaim page is moved to the tail
    of the inactive LRU list in rotate_reclaimable_page(), lru_lock spin lock is
    acquired every page writeback .  This deteriorates system performance and
    makes interrupt hold off time longer when swap-out started.
    
    Following patch solves this problem.  I use pagevec in rotating reclaimable
    pages to mitigate LRU spin lock contention and reduce interrupt hold off time.
    
    I did a test that allocating and touching pages in multiple processes, and
    pinging to the test machine in flooding mode to measure response under memory
    intensive load.
    
    The test result is:
    
    	-2.6.23-rc5
    	--- testmachine ping statistics ---
    	3000 packets transmitted, 3000 received, 0% packet loss, time 53222ms
    	rtt min/avg/max/mdev = 0.074/0.652/172.228/7.176 ms, pipe 11, ipg/ewma
    17.746/0.092 ms
    
    	-2.6.23-rc5-patched
    	--- testmachine ping statistics ---
    	3000 packets transmitted, 3000 received, 0% packet loss, time 51924ms
    	rtt min/avg/max/mdev = 0.072/0.108/3.884/0.114 ms, pipe 2, ipg/ewma
    17.314/0.091 ms
    
    Max round-trip-time was improved.
    
    The test machine spec is that 4CPU(3.16GHz, Hyper-threading enabled)
    8GB memory , 8GB swap.
    
    I did ping test again to observe performance deterioration caused by taking
    a ref.
    
    	-2.6.23-rc6-with-modifiedpatch
    	--- testmachine ping statistics ---
    	3000 packets transmitted, 3000 received, 0% packet loss, time 53386ms
    	rtt min/avg/max/mdev = 0.074/0.110/4.716/0.147 ms, pipe 2, ipg/ewma 17.801/0.129 ms
    
    The result for my original patch is as follows.
    
    	-2.6.23-rc5-with-originalpatch
    	--- testmachine ping statistics ---
    	3000 packets transmitted, 3000 received, 0% packet loss, time 51924ms
    	rtt min/avg/max/mdev = 0.072/0.108/3.884/0.114 ms, pipe 2, ipg/ewma 17.314/0.091 ms
    
    The influence to response was small.
    
    [akpm@linux-foundation.org: fix uninitalised var warning]
    [hugh@veritas.com: fix locking]
    [randy.dunlap@oracle.com: fix function declaration]
    [hugh@veritas.com: fix BUG at include/linux/mm.h:220!]
    [hugh@veritas.com: kill redundancy in rotate_reclaimable_page]
    [hugh@veritas.com: move_tail_pages into lru_add_drain]
    Signed-off-by: default avatarHisashi Hifumi <hifumi.hisashi@oss.ntt.co.jp>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    902aaed0
swap.c 13.2 KB