linux/mm
Michal Hocko dce59c2fae mm: consider all swapped back pages in used-once logic
commit e48982734e upstream.

Commit 6457474624 ("vmscan: detect mapped file pages used only once")
made mapped pages have another round in inactive list because they might
be just short lived and so we could consider them again next time.  This
heuristic helps to reduce pressure on the active list with a streaming
IO worklods.

This patch fixes a regression introduced by this commit for heavy shmem
based workloads because unlike Anon pages, which are excluded from this
heuristic because they are usually long lived, shmem pages are handled
as a regular page cache.

This doesn't work quite well, unfortunately, if the workload is mostly
backed by shmem (in memory database sitting on 80% of memory) with a
streaming IO in the background (backup - up to 20% of memory).  Anon
inactive list is full of (dirty) shmem pages when watermarks are hit.
Shmem pages are kept in the inactive list (they are referenced) in the
first round and it is hard to reclaim anything else so we reach lower
scanning priorities very quickly which leads to an excessive swap out.

Let's fix this by excluding all swap backed pages (they tend to be long
lived wrt.  the regular page cache anyway) from used-once heuristic and
rather activate them if they are referenced.

The customer's workload is shmem backed database (80% of RAM) and they
are measuring transactions/s with an IO in the background (20%).
Transactions touch more or less random rows in the table.  The
transaction rate fell by a factor of 3 (in the worst case) because of
commit 64574746.  This patch restores the previous numbers.

Signed-off-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Minchan Kim <minchan@kernel.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-10 00:32:57 +09:00
..
backing-dev.c backing-dev: ensure wakeup_timer is deleted 2011-11-21 14:31:25 -08:00
bootmem.c bootmem/sparsemem: remove limit constraint in alloc_bootmem_section 2012-04-02 09:27:11 -07:00
bounce.c
cleancache.c
compaction.c mm: compaction: check for overlapping nodes during isolation for migration 2012-02-13 11:06:11 -08:00
debug-pagealloc.c
dmapool.c
fadvise.c
failslab.c
filemap_xip.c mm/filemap_xip.c: fix race condition in xip_file_fault() 2012-02-13 11:06:07 -08:00
filemap.c readahead: fix pipeline break caused by block plug 2012-02-13 11:06:04 -08:00
fremap.c
highmem.c
huge_memory.c mm: thp: fix BUG on mm->nr_ptes 2012-03-12 10:32:56 -07:00
hugetlb.c hugetlb: prevent BUG_ON in hugetlb_fault() -> hugetlb_cow() 2012-05-21 09:40:02 -07:00
hwpoison-inject.c
init-mm.c
internal.h mm: thp: tail page refcounting fix 2011-11-11 09:36:29 -08:00
Kconfig
Kconfig.debug
kmemcheck.c
kmemleak-test.c
kmemleak.c
ksm.c
maccess.c
madvise.c
Makefile
memblock.c
memcontrol.c memcg: free spare array to avoid memory leak 2012-05-21 09:40:04 -07:00
memory_hotplug.c
memory-failure.c
memory.c mm: thp: fix pmd_bad() triggering in code paths holding mmap_sem read mode 2012-04-02 09:27:10 -07:00
mempolicy.c mm: mempolicy: Let vma_merge and vma_split handle vma->vm_policy linkages 2012-06-01 15:12:56 +08:00
mempool.c
migrate.c mm: fix race between mremap and removing migration entry 2011-10-25 07:10:17 +02:00
mincore.c mm: thp: fix pmd_bad() triggering in code paths holding mmap_sem read mode 2012-04-02 09:27:10 -07:00
mlock.c
mm_init.c
mmap.c
mmu_context.c
mmu_notifier.c
mmzone.c
mprotect.c
mremap.c
msync.c
nobootmem.c mm: nobootmem: fix sign extend problem in __free_pages_memory() 2012-05-21 09:40:02 -07:00
nommu.c NOMMU: Don't need to clear vm_mm when deleting a VMA 2012-03-12 10:32:56 -07:00
oom_kill.c oom: fix integer overflow of points in oom_badness 2012-01-06 14:13:51 -08:00
page_alloc.c mm: fix NULL ptr dereference in __count_immobile_pages 2012-01-25 17:25:05 -08:00
page_cgroup.c
page_io.c
page_isolation.c
page-writeback.c writeback: introduce .tagged_writepages for the WB_SYNC_NONE sync stage 2011-10-03 11:40:43 -07:00
pagewalk.c mm: thp: fix pmd_bad() triggering in code paths holding mmap_sem read mode 2012-04-02 09:27:10 -07:00
percpu-km.c
percpu-vm.c percpu: fix chunk range calculation 2011-12-21 12:57:37 -08:00
percpu.c percpu: pcpu_embed_first_chunk() should free unused parts after all allocs are complete 2012-05-21 09:40:02 -07:00
pgtable-generic.c
prio_tree.c
quicklist.c
readahead.c
rmap.c
shmem.c
slab.c
slob.c
slub.c slub: Do not hold slub_lock when calling sysfs_slab_add() 2012-04-02 09:27:20 -07:00
sparse-vmemmap.c
sparse.c bootmem/sparsemem: remove limit constraint in alloc_bootmem_section 2012-04-02 09:27:11 -07:00
swap_state.c mm: fix s390 BUG by __set_page_dirty_no_writeback on swap 2012-04-27 09:51:07 -07:00
swap.c mm: fix UP THP spin_is_locked BUGs 2012-02-13 11:06:11 -08:00
swapfile.c mm: thp: fix pmd_bad() triggering in code paths holding mmap_sem read mode 2012-04-02 09:27:10 -07:00
thrash.c
truncate.c mm: fix assertion mapping->nrpages == 0 in end_writeback() 2011-06-27 18:00:13 -07:00
util.c
vmalloc.c mm: vmalloc: check for page allocation failure before vmlist insertion 2011-12-21 12:57:36 -08:00
vmscan.c mm: consider all swapped back pages in used-once logic 2012-06-10 00:32:57 +09:00
vmstat.c