linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/6] add defer mechanism to ksm to make it more suitable for Android devices
@ 2015-06-10  6:27 Wenwei Tao
  2015-06-10  6:27 ` [RFC PATCH 1/6] mm: add defer mechanism to ksm to make it more suitable Wenwei Tao
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Wenwei Tao @ 2015-06-10  6:27 UTC (permalink / raw)
  To: izik.eidus, aarcange, chrisw, hughd, tglx, mingo, hpa, x86, viro
  Cc: linux-mm, linux-fsdevel, linux-kernel, linuxppc-dev, kvm,
	kvm-ppc, wenweitaowenwei

I observe that it is unlikely for KSM to merge new pages from an area
that has already been scanned twice on Android mobile devices, so it's
a waste of power to scan these areas in high frequency. In this patchset,
a defer mechanism is introduced which is borrowed from page compaction to KSM.

A new slot list called active_slot is added into ksm_scan. MMs which have
VMA marked for merging via madvise are added (MM is new to KSM) or moved to
(MM is in the ksm_scan.mm_slot list) active_slot. In "scan_get_next_rmap_item()",
the active_slot list will be scaned firstly unless it is empty, then the mm_slot list.
MMs in the active_slot list will be scaned twice, after that they will be moved
to mm_slot list. Once scanning the mm_slot list, the defer mechanism will be activated:

a) if KSM scans "ksm_thread_pages_to_scan" pages but none of them get
merged or become unstable, increase the ksm_defer_shift(new member of ksm_scan)
by one (no more than 6 by now). And in the next "1UL << ksm_scan.ksm_defer_shift"
times KSM been scheduled or woken up it will not do the actual scan, compare
and merge job, it just schedule out.

b) if KSM scans "ksm_thread_pages_to_scan" pages and more than zero of them
get merged or become unstable, reset the ksm_defer_shift and ksm_considered
to zero.

Some applications may continue to produce new mergeable VMAs to KSM, in order
to avoid scanning VMAs of these applications that have already been scanned twice,
we use VM_HUGETLB to indicate new mergeable VMAs since hugetlb vm are not
supported by KSM.

Wenwei Tao (6):
  mm: add defer mechanism to ksm to make it more suitable
  mm: change the condition of identifying hugetlb vm
  perf: change the condition of identifying hugetlb vm
  fs/binfmt_elf.c: change the condition of identifying hugetlb vm
  x86/mm: change the condition of identifying hugetlb vm
  powerpc/kvm: change the condition of identifying hugetlb vm

 arch/powerpc/kvm/e500_mmu_host.c |    3 +-
 arch/x86/mm/tlb.c                |    3 +-
 fs/binfmt_elf.c                  |    2 +-
 include/linux/hugetlb_inline.h   |    2 +-
 include/linux/mempolicy.h        |    2 +-
 kernel/events/core.c             |    2 +-
 mm/gup.c                         |    6 +-
 mm/huge_memory.c                 |   17 ++-
 mm/ksm.c                         |  230 +++++++++++++++++++++++++++++++++-----
 mm/madvise.c                     |    6 +-
 mm/memory.c                      |    5 +-
 mm/mprotect.c                    |    6 +-
 12 files changed, 238 insertions(+), 46 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-07-07 19:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-10  6:27 [RFC PATCH 0/6] add defer mechanism to ksm to make it more suitable for Android devices Wenwei Tao
2015-06-10  6:27 ` [RFC PATCH 1/6] mm: add defer mechanism to ksm to make it more suitable Wenwei Tao
2015-06-10  6:27 ` [RFC PATCH 2/6] mm: change the condition of identifying hugetlb vm Wenwei Tao
2015-06-10  6:27 ` [RFC PATCH 3/6] perf: " Wenwei Tao
2015-06-10  6:27 ` [RFC PATCH 4/6] fs/binfmt_elf.c: " Wenwei Tao
2015-06-10  6:27 ` [RFC PATCH 5/6] x86/mm: " Wenwei Tao
2015-06-10  6:27 ` [RFC PATCH 6/6] powerpc/kvm: " Wenwei Tao
2015-07-02 21:49   ` Scott Wood
2015-07-03  8:47     ` wenwei tao
2015-07-06 21:34       ` Scott Wood
2015-07-07  8:05         ` wenwei tao
2015-07-07 19:47           ` Scott Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).