* [PATCH v3 0/2] docs/ksm: fix advisor documentation and comment
@ 2026-08-24 6:10 Jinjiang Tu
2026-08-24 6:10 ` [PATCH v3 1/2] docs: ksm: fix typos in sysfs knob names Jinjiang Tu
2026-08-24 6:10 ` [PATCH v3 2/2] mm/ksm: fix advisor_min_pages_to_scan description Jinjiang Tu
0 siblings, 2 replies; 6+ messages in thread
From: Jinjiang Tu @ 2026-08-24 6:10 UTC (permalink / raw)
To: akpm, david, xu.xin16, chengming.zhou, ljs, liam, vbabka, rppt,
surenb, mhocko, corbet, skhan, shr, linux-mm, linux-doc
Cc: wangkefeng.wang, sunnanyong, tujinjiang
This series fixes two problems left in the KSM advisor documentation
and code comment:
- Patch 1 fixes two typos in sysfs knob names ("adivsor_max_cpu" and
"adivsor_max_pages_to_scan") in ksm.rst that don't match the actual
knob names.
- Patch 2 fixes the description of advisor_min_pages_to_scan: it is
described as the lower limit of pages_to_scan, but is actually only
used as it's initial value, and the runtime pages_to_scan can drop
below advisor_min_pages_to_scan.
Changes since v2:
* update cover letter
* update commit message for patch2
Changes since v1:
* remove fix tags for both patches
* update commit message and comment for patch2
* collect Acked-by for patch1
Jinjiang Tu (2):
docs: ksm: fix typos in sysfs knob names
mm/ksm: fix advisor_min_pages_to_scan description
Documentation/admin-guide/mm/ksm.rst | 8 ++++----
mm/ksm.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/2] docs: ksm: fix typos in sysfs knob names
2026-08-24 6:10 [PATCH v3 0/2] docs/ksm: fix advisor documentation and comment Jinjiang Tu
@ 2026-08-24 6:10 ` Jinjiang Tu
2026-08-24 16:51 ` Randy Dunlap
2026-08-24 6:10 ` [PATCH v3 2/2] mm/ksm: fix advisor_min_pages_to_scan description Jinjiang Tu
1 sibling, 1 reply; 6+ messages in thread
From: Jinjiang Tu @ 2026-08-24 6:10 UTC (permalink / raw)
To: akpm, david, xu.xin16, chengming.zhou, ljs, liam, vbabka, rppt,
surenb, mhocko, corbet, skhan, shr, linux-mm, linux-doc
Cc: wangkefeng.wang, sunnanyong, tujinjiang
The sysfs knob names in mm/ksm.c are "advisor_max_cpu" and
"advisor_max_pages_to_scan", but the ksm.rst documentation spelled
both as "adivsor_*", fix the two typos.
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com>
---
Documentation/admin-guide/mm/ksm.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/admin-guide/mm/ksm.rst b/Documentation/admin-guide/mm/ksm.rst
index ad8e7a41f3b5..c9f533b10f6f 100644
--- a/Documentation/admin-guide/mm/ksm.rst
+++ b/Documentation/admin-guide/mm/ksm.rst
@@ -174,7 +174,7 @@ advisor_mode
The section about ``advisor`` explains in detail how the scan time
advisor works.
-adivsor_max_cpu
+advisor_max_cpu
specifies the upper limit of the cpu percent usage of the ksmd
background thread. The default is 70.
@@ -186,7 +186,7 @@ advisor_min_pages_to_scan
specifies the lower limit of the ``pages_to_scan`` parameter of the
scan time advisor. The default is 500.
-adivsor_max_pages_to_scan
+advisor_max_pages_to_scan
specifies the upper limit of the ``pages_to_scan`` parameter of the
scan time advisor. The default is 30000.
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 2/2] mm/ksm: fix advisor_min_pages_to_scan description
2026-08-24 6:10 [PATCH v3 0/2] docs/ksm: fix advisor documentation and comment Jinjiang Tu
2026-08-24 6:10 ` [PATCH v3 1/2] docs: ksm: fix typos in sysfs knob names Jinjiang Tu
@ 2026-08-24 6:10 ` Jinjiang Tu
2026-08-24 10:10 ` David Hildenbrand (Arm)
2026-08-24 11:03 ` Lorenzo Stoakes (ARM)
1 sibling, 2 replies; 6+ messages in thread
From: Jinjiang Tu @ 2026-08-24 6:10 UTC (permalink / raw)
To: akpm, david, xu.xin16, chengming.zhou, ljs, liam, vbabka, rppt,
surenb, mhocko, corbet, skhan, shr, linux-mm, linux-doc
Cc: wangkefeng.wang, sunnanyong, tujinjiang
Both Documentation/admin-guide/mm/ksm.rst and the comment next to the
variable definition in mm/ksm.c describe advisor_min_pages_to_scan as a
lower limit of the pages_to_scan parameter, but that is not how the
scan-time advisor actually uses it. commit 4e5fa4f5eff6 ("mm/ksm: add ksm
advisor") only uses it to initialize ksm_thread_pages_to_scan when the
scan-time advisor is enabled.
ksm_thread_pages_to_scan is adjusted by scan_time_advisor() after a full
scan finishes. ksm_thread_pages_to_scan could be increased or decreased
depend on the real scan time is longer or shorter than the target scan
time. The min value of ksm_thread_pages_to_scan is only limited by
KSM_ADVISOR_MIN_CPU, so ksm_thread_pages_to_scan could be smaller than
ksm_advisor_min_pages_to_scan.
The semantics of advisor_min_pages_to_scan was updated in the v2 patchset
[1], but the documentation wasn't updated.
Update the documentation and comment to match the semantics of
advisor_min_pages_to_scan.
Link: https://lore.kernel.org/linux-mm/20231028000945.2428830-2-shr@devkernel.io/ [1]
Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com>
---
Documentation/admin-guide/mm/ksm.rst | 4 ++--
mm/ksm.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Documentation/admin-guide/mm/ksm.rst b/Documentation/admin-guide/mm/ksm.rst
index c9f533b10f6f..c329ca747b8c 100644
--- a/Documentation/admin-guide/mm/ksm.rst
+++ b/Documentation/admin-guide/mm/ksm.rst
@@ -183,8 +183,8 @@ advisor_target_scan_time
pages. The default value is 200 seconds.
advisor_min_pages_to_scan
- specifies the lower limit of the ``pages_to_scan`` parameter of the
- scan time advisor. The default is 500.
+ specifies the initial value of the ``pages_to_scan`` parameter of
+ the scan time advisor. The default is 500.
advisor_max_pages_to_scan
specifies the upper limit of the ``pages_to_scan`` parameter of the
diff --git a/mm/ksm.c b/mm/ksm.c
index 7d5b76478f0b..4a6cf8cf5d60 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -342,7 +342,7 @@ static enum ksm_advisor_type ksm_advisor;
* Only called through the sysfs control interface:
*/
-/* At least scan this many pages per batch. */
+/* Initial number of pages to scan per batch. */
static unsigned long ksm_advisor_min_pages_to_scan = 500;
static void set_advisor_defaults(void)
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3 2/2] mm/ksm: fix advisor_min_pages_to_scan description
2026-08-24 6:10 ` [PATCH v3 2/2] mm/ksm: fix advisor_min_pages_to_scan description Jinjiang Tu
@ 2026-08-24 10:10 ` David Hildenbrand (Arm)
2026-08-24 11:03 ` Lorenzo Stoakes (ARM)
1 sibling, 0 replies; 6+ messages in thread
From: David Hildenbrand (Arm) @ 2026-08-24 10:10 UTC (permalink / raw)
To: Jinjiang Tu, akpm, xu.xin16, chengming.zhou, ljs, liam, vbabka,
rppt, surenb, mhocko, corbet, skhan, shr, linux-mm, linux-doc
Cc: wangkefeng.wang, sunnanyong
On 8/24/26 08:10, Jinjiang Tu wrote:
> Both Documentation/admin-guide/mm/ksm.rst and the comment next to the
> variable definition in mm/ksm.c describe advisor_min_pages_to_scan as a
> lower limit of the pages_to_scan parameter, but that is not how the
> scan-time advisor actually uses it. commit 4e5fa4f5eff6 ("mm/ksm: add ksm
> advisor") only uses it to initialize ksm_thread_pages_to_scan when the
> scan-time advisor is enabled.
>
> ksm_thread_pages_to_scan is adjusted by scan_time_advisor() after a full
> scan finishes. ksm_thread_pages_to_scan could be increased or decreased
> depend on the real scan time is longer or shorter than the target scan
> time. The min value of ksm_thread_pages_to_scan is only limited by
> KSM_ADVISOR_MIN_CPU, so ksm_thread_pages_to_scan could be smaller than
> ksm_advisor_min_pages_to_scan.
>
> The semantics of advisor_min_pages_to_scan was updated in the v2 patchset
> [1], but the documentation wasn't updated.
>
> Update the documentation and comment to match the semantics of
> advisor_min_pages_to_scan.
>
> Link: https://lore.kernel.org/linux-mm/20231028000945.2428830-2-shr@devkernel.io/ [1]
> Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com>
> ---
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 2/2] mm/ksm: fix advisor_min_pages_to_scan description
2026-08-24 6:10 ` [PATCH v3 2/2] mm/ksm: fix advisor_min_pages_to_scan description Jinjiang Tu
2026-08-24 10:10 ` David Hildenbrand (Arm)
@ 2026-08-24 11:03 ` Lorenzo Stoakes (ARM)
1 sibling, 0 replies; 6+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-08-24 11:03 UTC (permalink / raw)
To: Jinjiang Tu
Cc: akpm, david, xu.xin16, chengming.zhou, liam, vbabka, rppt, surenb,
mhocko, corbet, skhan, shr, linux-mm, linux-doc, wangkefeng.wang,
sunnanyong
On Mon, Aug 24, 2026 at 02:10:10PM +0800, Jinjiang Tu wrote:
> Both Documentation/admin-guide/mm/ksm.rst and the comment next to the
> variable definition in mm/ksm.c describe advisor_min_pages_to_scan as a
> lower limit of the pages_to_scan parameter, but that is not how the
> scan-time advisor actually uses it. commit 4e5fa4f5eff6 ("mm/ksm: add ksm
> advisor") only uses it to initialize ksm_thread_pages_to_scan when the
> scan-time advisor is enabled.
>
> ksm_thread_pages_to_scan is adjusted by scan_time_advisor() after a full
> scan finishes. ksm_thread_pages_to_scan could be increased or decreased
> depend on the real scan time is longer or shorter than the target scan
> time. The min value of ksm_thread_pages_to_scan is only limited by
> KSM_ADVISOR_MIN_CPU, so ksm_thread_pages_to_scan could be smaller than
> ksm_advisor_min_pages_to_scan.
>
> The semantics of advisor_min_pages_to_scan was updated in the v2 patchset
> [1], but the documentation wasn't updated.
>
> Update the documentation and comment to match the semantics of
> advisor_min_pages_to_scan.
>
> Link: https://lore.kernel.org/linux-mm/20231028000945.2428830-2-shr@devkernel.io/ [1]
> Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com>
LGTM so:
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> ---
> Documentation/admin-guide/mm/ksm.rst | 4 ++--
> mm/ksm.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/admin-guide/mm/ksm.rst b/Documentation/admin-guide/mm/ksm.rst
> index c9f533b10f6f..c329ca747b8c 100644
> --- a/Documentation/admin-guide/mm/ksm.rst
> +++ b/Documentation/admin-guide/mm/ksm.rst
> @@ -183,8 +183,8 @@ advisor_target_scan_time
> pages. The default value is 200 seconds.
>
> advisor_min_pages_to_scan
> - specifies the lower limit of the ``pages_to_scan`` parameter of the
> - scan time advisor. The default is 500.
> + specifies the initial value of the ``pages_to_scan`` parameter of
> + the scan time advisor. The default is 500.
>
> advisor_max_pages_to_scan
> specifies the upper limit of the ``pages_to_scan`` parameter of the
> diff --git a/mm/ksm.c b/mm/ksm.c
> index 7d5b76478f0b..4a6cf8cf5d60 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -342,7 +342,7 @@ static enum ksm_advisor_type ksm_advisor;
> * Only called through the sysfs control interface:
> */
>
> -/* At least scan this many pages per batch. */
> +/* Initial number of pages to scan per batch. */
> static unsigned long ksm_advisor_min_pages_to_scan = 500;
>
> static void set_advisor_defaults(void)
> --
> 2.43.0
>
--
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/2] docs: ksm: fix typos in sysfs knob names
2026-08-24 6:10 ` [PATCH v3 1/2] docs: ksm: fix typos in sysfs knob names Jinjiang Tu
@ 2026-08-24 16:51 ` Randy Dunlap
0 siblings, 0 replies; 6+ messages in thread
From: Randy Dunlap @ 2026-08-24 16:51 UTC (permalink / raw)
To: Jinjiang Tu, akpm, david, xu.xin16, chengming.zhou, ljs, liam,
vbabka, rppt, surenb, mhocko, corbet, skhan, shr, linux-mm,
linux-doc
Cc: wangkefeng.wang, sunnanyong
On 8/23/26 11:10 PM, Jinjiang Tu wrote:
> The sysfs knob names in mm/ksm.c are "advisor_max_cpu" and
> "advisor_max_pages_to_scan", but the ksm.rst documentation spelled
> both as "adivsor_*", fix the two typos.
>
> Acked-by: David Hildenbrand (Arm) <david@kernel.org>
> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Thanks.
> ---
> Documentation/admin-guide/mm/ksm.rst | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/admin-guide/mm/ksm.rst b/Documentation/admin-guide/mm/ksm.rst
> index ad8e7a41f3b5..c9f533b10f6f 100644
> --- a/Documentation/admin-guide/mm/ksm.rst
> +++ b/Documentation/admin-guide/mm/ksm.rst
> @@ -174,7 +174,7 @@ advisor_mode
> The section about ``advisor`` explains in detail how the scan time
> advisor works.
>
> -adivsor_max_cpu
> +advisor_max_cpu
> specifies the upper limit of the cpu percent usage of the ksmd
> background thread. The default is 70.
>
> @@ -186,7 +186,7 @@ advisor_min_pages_to_scan
> specifies the lower limit of the ``pages_to_scan`` parameter of the
> scan time advisor. The default is 500.
>
> -adivsor_max_pages_to_scan
> +advisor_max_pages_to_scan
> specifies the upper limit of the ``pages_to_scan`` parameter of the
> scan time advisor. The default is 30000.
>
--
~Randy
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-08-24 16:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-24 6:10 [PATCH v3 0/2] docs/ksm: fix advisor documentation and comment Jinjiang Tu
2026-08-24 6:10 ` [PATCH v3 1/2] docs: ksm: fix typos in sysfs knob names Jinjiang Tu
2026-08-24 16:51 ` Randy Dunlap
2026-08-24 6:10 ` [PATCH v3 2/2] mm/ksm: fix advisor_min_pages_to_scan description Jinjiang Tu
2026-08-24 10:10 ` David Hildenbrand (Arm)
2026-08-24 11:03 ` Lorenzo Stoakes (ARM)
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).