[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1433917639-31699-1-git-send-email-wenweitaowenwei@gmail.com>
Date: Wed, 10 Jun 2015 14:27:13 +0800
From: Wenwei Tao <wenweitaowenwei@...il.com>
To: izik.eidus@...ellosystems.com, aarcange@...hat.com,
chrisw@...s-sol.org, hughd@...gle.com, tglx@...utronix.de,
mingo@...hat.com, hpa@...or.com, x86@...nel.org,
viro@...iv.linux.org.uk
Cc: linux-mm@...ck.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
kvm@...r.kernel.org, kvm-ppc@...r.kernel.org,
wenweitaowenwei@...il.com
Subject: [RFC PATCH 0/6] add defer mechanism to ksm to make it more suitable for Android devices
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists