linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] propose auto-run mode of ksm and its tests
@ 2022-08-12 10:11 cgel.zte
  2022-08-12 10:11 ` [PATCH v2 1/5] ksm: add a auto-run mode of ksm cgel.zte
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: cgel.zte @ 2022-08-12 10:11 UTC (permalink / raw)
  To: akpm, willy; +Cc: hughd, izik.eidus, linux-kernel, linux-mm, xu.xin16

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



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

end of thread, other threads:[~2022-08-12 10:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-12 10:11 [PATCH v2 0/5] propose auto-run mode of ksm and its tests cgel.zte
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox