From: Nai Xia <nai.xia@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Izik Eidus <izik.eidus@ravellosystems.com>,
Andrew Morton <akpm@linux-foundation.org>,
Hugh Dickins <hughd@google.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Chris Wright <chrisw@sous-sol.org>,
Andrea Arcangeli <aarcange@redhat.com>,
Rik van Riel <riel@redhat.com>, linux-mm <linux-mm@kvack.org>
Subject: [PATCH 0/2] ksm: take dirty bit as reference to avoid volatile pages
Date: Mon, 28 Mar 2011 22:14:18 +0800 [thread overview]
Message-ID: <201103282214.19345.nai.xia@gmail.com> (raw)
Currently, ksm uses page checksum to detect volatile pages. Izik Eidus
suggested that we could use pte dirty bit to optimize. This patch series
adds this new logic.
Preliminary benchmarks show that the scan speed is improved by up to 16
times on volatile transparent huge pages and up to 8 times on volatile
regular pages.
Following is the test program to show this top speed up (you need to make
ksmd takes about more than 90% of the cpu and watch the ksm/full_scans).
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#define MADV_MERGEABLE 12
#define SIZE (2000*1024*1024)
#define PAGE_SIZE 4096
int main(int argc, char **argv)
{
unsigned char *p;
int j;
int ret;
p = mmap(NULL, SIZE, PROT_WRITE|PROT_READ,
MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
if (p == MAP_FAILED) {
printf("mmap error\n");
return 0;
}
ret = madvise(p, SIZE, MADV_MERGEABLE);
if (ret==-1) {
printf("madvise failed \n");
return 0;
}
memset(p, 1, SIZE);
while (1) {
for (j=0; j<SIZE; j+=PAGE_SIZE) {
*((long*)(p+j+PAGE_SIZE-4)) = random();
}
}
return 0;
}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2011-03-28 14:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-28 14:14 Nai Xia [this message]
2011-03-28 14:59 ` [PATCH 0/2] ksm: take dirty bit as reference to avoid volatile pages Izik Eidus
2011-03-28 15:29 ` Nai Xia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201103282214.19345.nai.xia@gmail.com \
--to=nai.xia@gmail.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=chrisw@sous-sol.org \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=izik.eidus@ravellosystems.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=riel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).