From: Mel Gorman <mgorman@techsingularity.net>
To: wenyang.linux@foxmail.com
Cc: Andrew Morton <akpm@linux-foundation.org>,
Oscar Salvador <osalvador@suse.de>,
William Lam <william.lam@bytedance.com>,
Pintu Kumar <pintu@codeaurora.org>, Fu Wei <wefu@redhat.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm: compaction: optimize compact_memory to comply with the admin-guide
Date: Fri, 28 Apr 2023 11:58:48 +0100 [thread overview]
Message-ID: <20230428105848.ghtz5v3q6mug4hiw@techsingularity.net> (raw)
In-Reply-To: <tencent_DFF54DB2A60F3333F97D3F6B5441519B050A@qq.com>
On Tue, Apr 25, 2023 at 11:52:35PM +0800, wenyang.linux@foxmail.com wrote:
> From: Wen Yang <wenyang.linux@foxmail.com>
>
> For the /proc/sys/vm/compact_memory file, the admin-guide states:
> When 1 is written to the file, all zones are compacted such that free
> memory is available in contiguous blocks where possible. This can be
> important for example in the allocation of huge pages although processes
> will also directly compact memory as required
>
> But it was not strictly followed, writing any value would cause all
> zones to be compacted.
> It has been slightly optimized to comply with the admin-guide.
> Enforce the 1 on the unlikely chance that the sysctl handler is ever
> extended to do something different.
>
> Commit ef4984384172 ("mm/compaction: remove unused variable sysctl_compact_memory")
> has also been optimized a bit here, as the declaration in the external header
> file has been eliminated, and sysctl_compact_memory also needs to be verified.
>
> Signed-off-by: Wen Yang <wenyang.linux@foxmail.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Mel Gorman <mgorman@techsingularity.net>
> Cc: Oscar Salvador <osalvador@suse.de>
> Cc: William Lam <william.lam@bytedance.com>
> Cc: Pintu Kumar <pintu@codeaurora.org>
> Cc: Fu Wei <wefu@redhat.com>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> ---
> mm/compaction.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/mm/compaction.c b/mm/compaction.c
> index c8bcdea15f5f..ba57d4178866 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -1736,6 +1736,7 @@ static int sysctl_compact_unevictable_allowed __read_mostly = CONFIG_COMPACT_UNE
> */
> static unsigned int __read_mostly sysctl_compaction_proactiveness = 20;
> static int sysctl_extfrag_threshold = 500;
> +static int sysctl_compact_memory;
>
__read_mostly but that aside, it's only used in
sysctl_compaction_handler so could also be declared as static within
that function. That way if CONFIG_SYSCTL is not set, it should be
guaranteed that the compiler does not save storage for it.
It's minor enough that With or without another version;
Acked-by: Mel Gorman <mgorman@techsingularity.net>
--
Mel Gorman
SUSE Labs
next prev parent reply other threads:[~2023-04-28 10:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-25 15:52 wenyang.linux
2023-04-28 10:58 ` Mel Gorman [this message]
2023-05-02 20:50 ` Andrew Morton
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=20230428105848.ghtz5v3q6mug4hiw@techsingularity.net \
--to=mgorman@techsingularity.net \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=osalvador@suse.de \
--cc=pintu@codeaurora.org \
--cc=wefu@redhat.com \
--cc=wenyang.linux@foxmail.com \
--cc=william.lam@bytedance.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