linux-stable/mm
Li Wang 16e536ef47 zswap: re-check zswap_is_full() after do zswap_shrink()
/sys/../zswap/stored_pages keeps rising in a zswap test with
"zswap.max_pool_percent=0" parameter.  But it should not compress or
store pages any more since there is no space in the compressed pool.

Reproduce steps:
  1. Boot kernel with "zswap.enabled=1"
  2. Set the max_pool_percent to 0
      # echo 0 > /sys/module/zswap/parameters/max_pool_percent
  3. Do memory stress test to see if some pages have been compressed
      # stress --vm 1 --vm-bytes $mem_available"M" --timeout 60s
  4. Watching the 'stored_pages' number increasing or not

The root cause is:

  When zswap_max_pool_percent is set to 0 via kernel parameter,
  zswap_is_full() will always return true due to zswap_shrink().  But if
  the shinking is able to reclain a page successfully the code then
  proceeds to compressing/storing another page, so the value of
  stored_pages will keep changing.

To solve the issue, this patch adds a zswap_is_full() check again after
  zswap_shrink() to make sure it's now under the max_pool_percent, and to
  not compress/store if we reached the limit.

Link: http://lkml.kernel.org/r/20180530103936.17812-1-liwang@redhat.com
Signed-off-by: Li Wang <liwang@redhat.com>
Acked-by: Dan Streetman <ddstreet@ieee.org>
Cc: Seth Jennings <sjenning@redhat.com>
Cc: Huang Ying <huang.ying.caritas@gmail.com>
Cc: Yu Zhao <yuzhao@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-07-26 19:38:03 -07:00
..
kasan kasan: fix shadow_size calculation error in kasan_module_alloc 2018-07-03 17:32:19 -07:00
backing-dev.c
balloon_compaction.c
bootmem.c
cleancache.c
cma.c
cma.h
cma_debug.c
compaction.c
debug.c mm: teach dump_page() to correctly output poisoned struct pages 2018-07-03 17:32:19 -07:00
debug_page_ref.c
dmapool.c
early_ioremap.c
fadvise.c
failslab.c
filemap.c
frame_vector.c
frontswap.c
gup.c mm: do not bug_on on incorrect length in __mm_populate() 2018-07-14 11:11:10 -07:00
gup_benchmark.c
highmem.c
hmm.c
huge_memory.c mm/huge_memory.c: fix data loss when splitting a file pmd 2018-07-21 12:50:46 -07:00
hugetlb.c mm: hugetlb: yield when prepping struct pages 2018-07-03 17:32:19 -07:00
hugetlb_cgroup.c
hwpoison-inject.c
init-mm.c
internal.h
interval_tree.c
Kconfig
Kconfig.debug
khugepaged.c
kmemleak-test.c
kmemleak.c
ksm.c
list_lru.c
maccess.c
madvise.c
Makefile
memblock.c mm/memblock: add missing include <linux/bootmem.h> 2018-07-21 12:50:46 -07:00
memcontrol.c mm: memcg: fix use after free in mem_cgroup_iter() 2018-07-21 12:50:46 -07:00
memfd.c
memory-failure.c
memory.c
memory_hotplug.c
mempolicy.c mm: use vma_init() to initialize VMAs on stack and data segments 2018-07-26 19:38:03 -07:00
mempool.c
memtest.c
migrate.c
mincore.c
mlock.c
mm_init.c
mmap.c mm: fix vma_is_anonymous() false-positives 2018-07-26 19:38:03 -07:00
mmu_context.c
mmu_notifier.c
mmzone.c
mprotect.c
mremap.c
msync.c
nobootmem.c
nommu.c mm: fix vma_is_anonymous() false-positives 2018-07-26 19:38:03 -07:00
oom_kill.c
page-writeback.c
page_alloc.c mm: don't do zero_resv_unavail if memmap is not allocated 2018-07-16 09:41:57 -07:00
page_counter.c
page_ext.c
page_idle.c
page_io.c
page_isolation.c
page_owner.c
page_poison.c
page_vma_mapped.c
pagewalk.c
percpu-internal.h
percpu-km.c
percpu-stats.c
percpu-vm.c
percpu.c
pgtable-generic.c
process_vm_access.c
quicklist.c
readahead.c
rmap.c mm: do not drop unused pages when userfaultd is running 2018-07-14 11:11:09 -07:00
rodata_test.c
shmem.c mm: use vma_init() to initialize VMAs on stack and data segments 2018-07-26 19:38:03 -07:00
slab.c
slab.h
slab_common.c slub: fix failure when we delete and create a slab cache 2018-06-28 11:16:44 -07:00
slob.c
slub.c slub: fix failure when we delete and create a slab cache 2018-06-28 11:16:44 -07:00
sparse-vmemmap.c
sparse.c
swap.c
swap_cgroup.c
swap_slots.c
swap_state.c
swapfile.c
truncate.c
usercopy.c
userfaultfd.c
util.c
vmacache.c
vmalloc.c
vmpressure.c
vmscan.c
vmstat.c
workingset.c
z3fold.c
zbud.c
zpool.c
zsmalloc.c
zswap.c zswap: re-check zswap_is_full() after do zswap_shrink() 2018-07-26 19:38:03 -07:00