From: Christian Brauner <brauner@kernel.org>
To: Ruiwu Chen <rwchen404@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
viro@zeniv.linux.org.uk, jack@suse.cz, kees@kernel.org,
joel.granados@kernel.org, zachwade.k@gmail.com
Subject: Re: [PATCH] drop_caches: re-enable message after disabling
Date: Mon, 17 Feb 2025 09:28:30 +0100 [thread overview]
Message-ID: <20250217-diskette-obskur-a3529a2f6a7f@brauner> (raw)
In-Reply-To: <20250216101729.2332-1-rwchen404@gmail.com>
On Sun, Feb 16, 2025 at 06:17:29PM +0800, Ruiwu Chen wrote:
> When 'echo 4 > /proc/sys/vm/drop_caches' the message is disabled,
> but there is no interface to enable the message, only by restarting
> the way, so I want to add the 'echo 0 > /proc/sys/vm/drop_caches'
> way to enabled the message again.
>
> Signed-off-by: Ruiwu Chen <rwchen404@gmail.com>
> ---
> fs/drop_caches.c | 7 +++++--
> kernel/sysctl.c | 2 +-
> 2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/fs/drop_caches.c b/fs/drop_caches.c
> index d45ef541d848..c90cfaf9756d 100644
> --- a/fs/drop_caches.c
> +++ b/fs/drop_caches.c
> @@ -57,7 +57,7 @@ int drop_caches_sysctl_handler(const struct ctl_table *table, int write,
> if (ret)
> return ret;
> if (write) {
> - static int stfu;
> + static bool stfu;
Please the change and change that to something explicitly like "silent".
>
> if (sysctl_drop_caches & 1) {
> lru_add_drain_all();
> @@ -73,7 +73,10 @@ int drop_caches_sysctl_handler(const struct ctl_table *table, int write,
> current->comm, task_pid_nr(current),
> sysctl_drop_caches);
> }
> - stfu |= sysctl_drop_caches & 4;
> + if (sysctl_drop_caches == 0)
> + stfu = false;
> + else if (sysctl_drop_caches == 4)
> + stfu = true;
> }
> return 0;
> }
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index cb57da499ebb..f2e06e074724 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -2088,7 +2088,7 @@ static const struct ctl_table vm_table[] = {
> .maxlen = sizeof(int),
> .mode = 0200,
> .proc_handler = drop_caches_sysctl_handler,
> - .extra1 = SYSCTL_ONE,
> + .extra1 = SYSCTL_ZERO,
> .extra2 = SYSCTL_FOUR,
> },
> {
> --
> 2.27.0
>
next prev parent reply other threads:[~2025-02-17 8:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-16 10:17 [PATCH] drop_caches: re-enable message after disabling Ruiwu Chen
2025-02-16 17:07 ` Darrick J. Wong
2025-02-17 8:28 ` Christian Brauner [this message]
2025-02-20 13:18 ` [PATCH v2] " Ruiwu Chen
2025-02-21 8:52 ` [PATCH] " Joel Granados
-- strict thread matches above, loose matches on Subject: below --
2025-02-16 10:05 Ruiwu Chen
2025-02-21 8:50 ` Joel Granados
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=20250217-diskette-obskur-a3529a2f6a7f@brauner \
--to=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=joel.granados@kernel.org \
--cc=kees@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rwchen404@gmail.com \
--cc=viro@zeniv.linux.org.uk \
--cc=zachwade.k@gmail.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;
as well as URLs for NNTP newsgroup(s).