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 v1 2/4] mm/ksm: add pages_skipped metric
Date: Mon, 18 Sep 2023 13:28:06 +0200 [thread overview]
Message-ID: <67c0bbac-aa4a-28ce-5416-e41af794e899@redhat.com> (raw)
In-Reply-To: <20230912175228.952039-3-shr@devkernel.io>
On 12.09.23 19:52, Stefan Roesch wrote:
> This change adds the "pages skipped" metric. To be able to evaluate how
> successful smart page scanning is, the pages skipped metric can be
> compared to the pages scanned metric.
>
> The pages skipped metric is a cumulative counter. The counter is stored
> under /sys/kernel/mm/ksm/pages_skipped.
>
> Signed-off-by: Stefan Roesch <shr@devkernel.io>
> ---
> mm/ksm.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/mm/ksm.c b/mm/ksm.c
> index bfd5087c7d5a..728574a3033e 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -293,6 +293,9 @@ static bool ksm_smart_scan;
> /* The number of zero pages which is placed by KSM */
> unsigned long ksm_zero_pages;
>
> +/* The number of pages that have been skipped due to "smart scanning" */
> +static unsigned long ksm_pages_skipped;
> +
> #ifdef CONFIG_NUMA
> /* Zeroed when merging across nodes is not allowed */
> static unsigned int ksm_merge_across_nodes = 1;
> @@ -2345,6 +2348,7 @@ static bool skip_rmap_item(struct page *page, struct ksm_rmap_item *rmap_item)
> return false;
> }
>
> + ksm_pages_skipped++;
> if (rmap_item->skip_age == 0) {
> rmap_item->skip_age = age + inc_skip_age(age);
> remove_rmap_item_from_tree(rmap_item);
> @@ -3435,6 +3439,13 @@ static ssize_t pages_volatile_show(struct kobject *kobj,
> }
> KSM_ATTR_RO(pages_volatile);
>
> +static ssize_t pages_skipped_show(struct kobject *kobj,
> + struct kobj_attribute *attr, char *buf)
> +{
> + return sysfs_emit(buf, "%lu\n", ksm_pages_skipped);
> +}
> +KSM_ATTR_RO(pages_skipped);
> +
> static ssize_t ksm_zero_pages_show(struct kobject *kobj,
> struct kobj_attribute *attr, char *buf)
> {
> @@ -3532,6 +3543,7 @@ static struct attribute *ksm_attrs[] = {
> &pages_sharing_attr.attr,
> &pages_unshared_attr.attr,
> &pages_volatile_attr.attr,
> + &pages_skipped_attr.attr,
> &ksm_zero_pages_attr.attr,
> &full_scans_attr.attr,
> #ifdef CONFIG_NUMA
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2023-09-18 11:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-12 17:52 [PATCH v1 0/4] Smart scanning mode for KSM Stefan Roesch
2023-09-12 17:52 ` [PATCH v1 1/4] mm/ksm: add "smart" page scanning mode Stefan Roesch
2023-09-13 21:07 ` Andrew Morton
2023-09-18 18:47 ` Stefan Roesch
2023-09-18 11:10 ` David Hildenbrand
2023-09-18 16:18 ` Stefan Roesch
2023-09-18 16:54 ` David Hildenbrand
2023-09-18 17:22 ` Stefan Roesch
2023-09-12 17:52 ` [PATCH v1 2/4] mm/ksm: add pages_skipped metric Stefan Roesch
2023-09-18 11:28 ` David Hildenbrand [this message]
2023-09-12 17:52 ` [PATCH v1 3/4] mm/ksm: document smart scan mode Stefan Roesch
2023-09-18 11:28 ` David Hildenbrand
2023-09-12 17:52 ` [PATCH v1 4/4] mm/ksm: document pages_skipped sysfs knob Stefan Roesch
2023-09-18 11:28 ` David Hildenbrand
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=67c0bbac-aa4a-28ce-5416-e41af794e899@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;
as well as URLs for NNTP newsgroup(s).