From: David Hildenbrand <david@redhat.com>
To: Ryan Roberts <ryan.roberts@arm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jonathan Corbet <corbet@lwn.net>, Barry Song <baohua@kernel.org>,
Lance Yang <ioworker0@gmail.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v2] mm: Override mTHP "enabled" defaults at kernel cmdline
Date: Fri, 9 Aug 2024 11:19:13 +0200 [thread overview]
Message-ID: <99b78488-c524-4269-b1fb-a13eaa4f274c@redhat.com> (raw)
In-Reply-To: <20240808101700.571701-1-ryan.roberts@arm.com>
On 08.08.24 12:16, Ryan Roberts wrote:
> Add thp_anon= cmdline parameter to allow specifying the default
> enablement of each supported anon THP size. The parameter accepts the
> following format and can be provided multiple times to configure each
> size:
>
> thp_anon=<size>[KMG]:<value>
>
> See Documentation/admin-guide/mm/transhuge.rst for more details.
>
> Configuring the defaults at boot time is useful to allow early user
> space to take advantage of mTHP before its been configured through
> sysfs.
I suspect a khugeapged enhancement and/or kernel-config-dependant
defaults and/or early system settings will also be able to mitigate that
without getting kernel cmdlines involved in the future.
>
> Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
> ---
>
> Hi All,
>
> I've split this off from my RFC at [1] because Barry highlighted that he would
> benefit from it immediately [2]. There are no changes vs the version in that
> series.
>
> It applies against today's mm-unstable (275d686abcb59). (although I had to fix a
> minor build bug in stackdepot.c due to MIN() not being defined in this tree).
>
> Thanks,
> Ryan
>
>
> .../admin-guide/kernel-parameters.txt | 8 +++
> Documentation/admin-guide/mm/transhuge.rst | 26 +++++++--
> mm/huge_memory.c | 55 ++++++++++++++++++-
> 3 files changed, 82 insertions(+), 7 deletions(-)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index bcdee8984e1f0..5c79b58c108ec 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -6631,6 +6631,14 @@
> <deci-seconds>: poll all this frequency
> 0: no polling (default)
>
> + thp_anon= [KNL]
> + Format: <size>[KMG]:always|madvise|never|inherit
> + Can be used to control the default behavior of the
> + system with respect to anonymous transparent hugepages.
> + Can be used multiple times for multiple anon THP sizes.
> + See Documentation/admin-guide/mm/transhuge.rst for more
> + details.
> +
> threadirqs [KNL,EARLY]
> Force threading of all interrupt handlers except those
> marked explicitly IRQF_NO_THREAD.
> diff --git a/Documentation/admin-guide/mm/transhuge.rst b/Documentation/admin-guide/mm/transhuge.rst
> index 24eec1c03ad88..f63b0717366c6 100644
> --- a/Documentation/admin-guide/mm/transhuge.rst
> +++ b/Documentation/admin-guide/mm/transhuge.rst
> @@ -284,13 +284,27 @@ that THP is shared. Exceeding the number would block the collapse::
>
> A higher value may increase memory footprint for some workloads.
>
> -Boot parameter
> -==============
> +Boot parameters
> +===============
>
> -You can change the sysfs boot time defaults of Transparent Hugepage
> -Support by passing the parameter ``transparent_hugepage=always`` or
> -``transparent_hugepage=madvise`` or ``transparent_hugepage=never``
> -to the kernel command line.
> +You can change the sysfs boot time default for the top-level "enabled"
> +control by passing the parameter ``transparent_hugepage=always`` or
> +``transparent_hugepage=madvise`` or ``transparent_hugepage=never`` to the
> +kernel command line.
> +
> +Alternatively, each supported anonymous THP size can be controlled by
> +passing ``thp_anon=<size>[KMG]:<state>``, where ``<size>`` is the THP size
> +and ``<state>`` is one of ``always``, ``madvise``, ``never`` or
> +``inherit``.
> +
> +For example, the following will set 64K THP to ``always``::
> +
> + thp_anon=64K:always
> +
> +``thp_anon=`` may be specified multiple times to configure all THP sizes as
> +required. If ``thp_anon=`` is specified at least once, any anon THP sizes
> +not explicitly configured on the command line are implicitly set to
> +``never``.
I suggest documenting that "thp_anon=" will not effect the value of
"transparent_hugepage=", or any configured default.
Wondering if a syntax like
thp_anon=16K,32K,64K:always;1048K,2048K:madvise
(one could also support ranges, like "16K-64K")
Would be even better. Then, maybe only allow a single instance.
Maybe consider it if it's not too crazy to parse ;)
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2024-08-09 9:19 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240808101700.571701-1-ryan.roberts@arm.com>
2024-08-08 21:17 ` Barry Song
2024-08-09 7:58 ` Ryan Roberts
2024-08-09 8:31 ` Barry Song
2024-08-09 8:57 ` Ryan Roberts
2024-08-09 9:04 ` Barry Song
2024-08-09 8:49 ` Baolin Wang
2024-08-09 8:52 ` Barry Song
2024-08-09 9:19 ` David Hildenbrand [this message]
2024-08-09 9:24 ` Barry Song
2024-08-09 9:32 ` David Hildenbrand
2024-08-09 10:37 ` Ryan Roberts
2024-08-09 11:37 ` Barry Song
2024-08-09 13:15 ` David Hildenbrand
2024-08-12 5:36 ` Barry Song
2024-08-12 8:20 ` David Hildenbrand
2024-08-12 8:36 ` Barry Song
2024-08-12 9:05 ` 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=99b78488-c524-4269-b1fb-a13eaa4f274c@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=corbet@lwn.net \
--cc=ioworker0@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ryan.roberts@arm.com \
/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