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 2/4] mm/ksm: add sysfs knobs for advisor
Date: Tue, 12 Dec 2023 14:45:26 +0100 [thread overview]
Message-ID: <ebea3b6f-efc0-4d98-bf4d-3e2b867fa886@redhat.com> (raw)
In-Reply-To: <20231204234906.1237478-3-shr@devkernel.io>
On 05.12.23 00:49, Stefan Roesch wrote:
> This adds four new knobs for the KSM advisor to influence its behaviour.
>
> The knobs are:
> - advisor_mode:
> none: no advisor (default)
> scan-time: scan time advisor
> - advisor_max_cpu: 70 (default, cpu usage percent)
> - advisor_min_pages: 500 (default)
> - advisor_max_pages: 30000 (default)
> - advisor_target_scan_time: 200 (default in seconds)
>
> The new values will take effect on the next scan round.
>
> Signed-off-by: Stefan Roesch <shr@devkernel.io>
> ---
> mm/ksm.c | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 127 insertions(+)
>
> diff --git a/mm/ksm.c b/mm/ksm.c
> index b27010fa2e946..18b7185bbc65b 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -3735,6 +3735,128 @@ static ssize_t smart_scan_store(struct kobject *kobj,
> }
> KSM_ATTR(smart_scan);
>
> +static ssize_t advisor_mode_show(struct kobject *kobj,
> + struct kobj_attribute *attr, char *buf)
> +{
> + const char *output;
> +
> + if (ksm_advisor == KSM_ADVISOR_NONE)
> + output = "[none] scan-time";
> + else if (ksm_advisor == KSM_ADVISOR_SCAN_TIME)
> + output = "none [scan-time]";
> +
> + return sysfs_emit(buf, "%s\n", output);
> +}
> +
> +static ssize_t advisor_mode_store(struct kobject *kobj,
> + struct kobj_attribute *attr, const char *buf,
> + size_t count)
> +{
> + if (sysfs_streq("scan-time", buf))
> + ksm_advisor = KSM_ADVISOR_SCAN_TIME;
> + else if (sysfs_streq("none", buf))
> + ksm_advisor = KSM_ADVISOR_NONE;
> + else
> + return -EINVAL;
> +
> + /* Set advisor default values */
> + init_advisor();
Is the "init_advisor()" really required?
> + set_advisor_defaults();
That function should go to this patch.
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2023-12-12 13:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-04 23:49 [PATCH v3 0/4] mm/ksm: Add ksm advisor Stefan Roesch
2023-12-04 23:49 ` [PATCH v3 1/4] mm/ksm: add " Stefan Roesch
2023-12-06 15:17 ` kernel test robot
2023-12-12 13:44 ` David Hildenbrand
2023-12-12 18:32 ` Stefan Roesch
2023-12-04 23:49 ` [PATCH v3 2/4] mm/ksm: add sysfs knobs for advisor Stefan Roesch
2023-12-12 13:45 ` David Hildenbrand [this message]
2023-12-12 18:02 ` Stefan Roesch
2023-12-12 18:07 ` David Hildenbrand
2023-12-12 18:27 ` Stefan Roesch
2023-12-04 23:49 ` [PATCH v3 3/4] mm/ksm: add tracepoint for ksm advisor Stefan Roesch
2023-12-12 13:45 ` David Hildenbrand
2023-12-04 23:49 ` [PATCH v3 4/4] mm/ksm: document ksm advisor and its sysfs knobs Stefan Roesch
2023-12-12 13:46 ` David Hildenbrand
2023-12-05 20:46 ` [PATCH v3 0/4] mm/ksm: Add ksm advisor Andrew Morton
2023-12-07 23:18 ` 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=ebea3b6f-efc0-4d98-bf4d-3e2b867fa886@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