linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Stefan Roesch <shr@devkernel.io>, kernel-team@fb.com
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, riel@surriel.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v3 1/4] mm/ksm: add "smart" page scanning mode
Date: Tue, 26 Sep 2023 09:41:33 +0200	[thread overview]
Message-ID: <ae2be79c-a030-a4d2-0d89-15efa17fe77c@redhat.com> (raw)
In-Reply-To: <20230926040939.516161-2-shr@devkernel.io>

On 26.09.23 06:09, Stefan Roesch wrote:
> This change adds a "smart" page scanning mode for KSM. So far all the
> candidate pages are continuously scanned to find candidates for
> de-duplication. There are a considerably number of pages that cannot be
> de-duplicated. This is costly in terms of CPU. By using smart scanning
> considerable CPU savings can be achieved.
> 
> This change takes the history of scanning pages into account and skips
> the page scanning of certain pages for a while if de-deduplication for
> this page has not been successful in the past.
> 
> To do this it introduces two new fields in the ksm_rmap_item structure:
> age and remaining_skips. age, is the KSM age and remaining_skips
> determines how often scanning of this page is skipped. The age field is
> incremented each time the page is scanned and the page cannot be de-
> duplicated. age updated is capped at U8_MAX.
> 
> How often a page is skipped is dependent how often de-duplication has
> been tried so far and the number of skips is currently limited to 8.
> This value has shown to be effective with different workloads.
> 
> The feature is currently disable by default and can be enabled with the
> new smart_scan knob.
> 
> The feature has shown to be very effective: upt to 25% of the page scans
> can be eliminated; the pages_to_scan rate can be reduced by 40 - 50% and
> a similar de-duplication rate can be maintained.

Thinking about it, what are the cons of just enabling this always and 
not exposing new toggles? Alternatively, we could make this a 
compile-time option.

In general, LGTM, just curious if we really have to make this configurable.

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2023-09-26  7:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-26  4:09 [PATCH v3 0/4] Smart scanning mode for KSM Stefan Roesch
2023-09-26  4:09 ` [PATCH v3 1/4] mm/ksm: add "smart" page scanning mode Stefan Roesch
2023-09-26  7:41   ` David Hildenbrand [this message]
2023-09-26 16:13     ` Stefan Roesch
2023-09-26 21:09       ` Andrew Morton
2023-09-27  0:39         ` Stefan Roesch
2023-09-27  9:57           ` David Hildenbrand
2023-09-26  4:09 ` [PATCH v3 2/4] mm/ksm: add pages_skipped metric Stefan Roesch
2023-09-26  4:09 ` [PATCH v3 3/4] mm/ksm: document smart scan mode Stefan Roesch
2023-09-26  4:09 ` [PATCH v3 4/4] mm/ksm: document pages_skipped sysfs knob Stefan Roesch

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=ae2be79c-a030-a4d2-0d89-15efa17fe77c@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=riel@surriel.com \
    --cc=shr@devkernel.io \
    /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