]> Git Repo - linux.git/commit - mm/ksm.c
mm/ksm: refactor out try_to_merge_with_zero_page()
authorChengming Zhou <[email protected]>
Fri, 21 Jun 2024 07:54:29 +0000 (15:54 +0800)
committerAndrew Morton <[email protected]>
Fri, 5 Jul 2024 01:05:50 +0000 (18:05 -0700)
commitac90c56bbd734addc9bfb4567f64f1c180c64f5d
treeb6cb53d3bb23d10bb4e60005d53bd8900c7cc5f1
parent003af997c8a945493859dd1a2d015cc9387ff27a
mm/ksm: refactor out try_to_merge_with_zero_page()

Patch series "mm/ksm: cmp_and_merge_page() optimizations and cleanup", v2.

This series mainly optimizes cmp_and_merge_page() to have more efficient
separate code flow for ksm page and non-ksm anon page.

- ksm page: don't need to calculate the checksum obviously.
- anon page: don't need to search stable tree if changing fast and try
  to merge with zero page before searching ksm page on stable tree.

Please see the patch-2 for details.

Patch-3 is cleanup also a little optimization for the chain()/chain_prune
interfaces, which made the stable_tree_search()/stable_tree_insert() over
complex.

I have done simple testing using "hackbench -g 1 -l 300000" (maybe I need
to use a better workload) on my machine, have seen a little CPU usage
decrease of ksmd and some improvements of cmp_and_merge_page() latency:

We can see the latency of cmp_and_merge_page() when handling non-ksm anon
pages has been improved.

This patch (of 3):

In preparation for later changes, refactor out a new function called
try_to_merge_with_zero_page(), which tries to merge with zero page.

Link: https://lkml.kernel.org/r/[email protected]
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Chengming Zhou <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Stefan Roesch <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
mm/hugetlb.c
mm/ksm.c
This page took 0.047372 seconds and 4 git commands to generate.