From: cgel.zte@gmail.com
To: akpm@linux-foundation.org, willy@infradead.org
Cc: hughd@google.com, izik.eidus@ravellosystems.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
xu.xin16@zte.com.cn
Subject: [PATCH v2 0/5] propose auto-run mode of ksm and its tests
Date: Fri, 12 Aug 2022 10:11:02 +0000 [thread overview]
Message-ID: <20220812101102.41422-1-xu.xin16@zte.com.cn> (raw)
From: xu xin <xu.xin16@zte.com.cn>
The following patch series bring a NEW running state "auto mode". In
traditional KSM, whether ksmd works scanning and merging or not
depends on the sysfs klob ksm_run.
Most of time, letting ksmd run is not very much needed, for example,
when memory is sufficient, because it increases the delays of COW for
user applications and also consume extra cpu resource. Besides, the fixed
pages_to_scan is not always good. When there are a lot of same pages,
the default pages_to_scan makes ksmd so slow to merge them.
The four patches try to optimize the above two points with a auto mode.
It's a lightweight optimization to KSM, not like uksm or pksm and so on.
The tests show:
The convergence time of merging time of auto-mode reduces can low to
HALF of normal-mode. The cpu consumption of auto-mode also get less
than normal-mode.
There are two type of TEST which have different shape of samepage areas.
One is full-samepages vm areas, and the other is sparse-samepage areas.
Both of the madvise area'size are 300MB.
Here is test log:
****************** TEST 1 ******************
Now the shape of memory area is full-samepages:
[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]
Start to test normal-run ksmd...
ksm current cpu total slice: 15274
ksm normal-run's merging time: 45.596018 seconds
ksm current cpu total slice: 16370
Start to test auto-run ksmd...
ksm auto-run's merging time: 17.599391 seconds
ksm current cpu total slice: 16488
****************** TEST 2 ******************
Now the shape of memory area is sparse-samepages:
[xx] [xx] [xx]
Start to test normal-run ksmd...
ksm current cpu total slice: 16532
ksm normal-run's merging time: 21.625451 seconds
ksm current cpu total slice: 16833
Start to test auto-run ksmd...
ksm auto-run's merging time: 17.684379 seconds
ksm current cpu total slice: 16950
Change log
==========
for v2:
1. We adjust the scan-enhanced algorithm, abstract its implementation
into a single function, which is clearer and smoother.
2. Add tests of auto-mode of ksm to verify the effectiveness.
xu xin (5):
ksm: add a auto-run mode of ksm
ksm: implement scan-enhanced algorithm
ksm: let ksmd auto-work with memory threshold
ksm: show ksmd status for auto mode
ksm: add tests of ksm auto mode
mm/ksm.c | 250 ++++++++++++++++++-
tools/testing/selftests/vm/.gitignore | 1 +
tools/testing/selftests/vm/Makefile | 1 +
tools/testing/selftests/vm/test-ksm-auto.c | 273 +++++++++++++++++++++
4 files changed, 519 insertions(+), 6 deletions(-)
create mode 100644 tools/testing/selftests/vm/test-ksm-auto.c
--
2.25.1
next reply other threads:[~2022-08-12 10:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-12 10:11 cgel.zte [this message]
2022-08-12 10:11 ` [PATCH v2 1/5] ksm: add a auto-run mode of ksm cgel.zte
2022-08-12 10:12 ` [PATCH v2 2/5] ksm: implement scan-enhanced algorithm cgel.zte
2022-08-12 10:12 ` [PATCH v2 3/5] ksm: let ksmd auto-work with memory threshold cgel.zte
2022-08-12 10:12 ` [PATCH v2 4/5] ksm: show ksmd status for auto mode cgel.zte
2022-08-12 10:12 ` [PATCH v2 5/5] ksm: add tests of ksm " cgel.zte
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=20220812101102.41422-1-xu.xin16@zte.com.cn \
--to=cgel.zte@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=izik.eidus@ravellosystems.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
--cc=xu.xin16@zte.com.cn \
/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