drop_caches: re-enable message after disabling
Subsystems (4)
PATCH 1/1 drop_caches: re-enable message after disabling
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.
--- fs/drop_caches.c | 7 +++++-- kernel/sysctl.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-)
fs/drop_caches.c +5 -2
@@ -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;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 ; }
kernel/sysctl.c +1 -1
@@ -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, }, {
Signature · 1 line
2.27.0
Quoted 4 lines · Ruiwu Chen
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.
Please update Documentation/ to note this new API.
--D
Quoted 48 lines
Signed-off-by Ruiwu Chen <[email protected]>--- fs/drop_caches.c | 7 +++++-- kernel/sysctl.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-)fs/drop_caches.c +5
-2@@ -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;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 ; }kernel/sysctl.c +1
-1@@ -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, }, {Signature · 1 line
2.27.0
Christian Brauner
maintainerQuoted 16 lines · Ruiwu Chen
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 <[email protected]>--- fs/drop_caches.c | 7 +++++-- kernel/sysctl.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-)fs/drop_caches.c +0
-0
fs/drop_caches.c int drop_caches_sysctl_handler(const struct ctl_table *table, int write, · line 60
Quoted 5 lines
fs/drop_caches.c +1
-1@@ -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".
Quoted 31 lines
fs/drop_caches.c +4
-1if (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 ; }kernel/sysctl.c +1
-1@@ -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, }, {Signature · 1 line
2.27.0
PATCH v2 1/1 drop_caches: re-enable message after disabling
In reply to Ruiwu ChenWhen '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.
---
v2: - updated Documentation/ to note this new API.
- renamed the variable.
Documentation/admin-guide/sysctl/vm.rst | 11 ++++++++++- fs/drop_caches.c | 9 ++++++--- kernel/sysctl.c | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-)
Documentation/admin-guide/sysctl/vm.rst +10 -1
@@ -266,7 +266,16 @@ used:: cat (1234): drop_caches: 3 These are informational only. They do not mean that anything is wrong -with your system. To disable them, echo 4 (bit 2) into drop_caches. +with your system. + +To disable informational:: + + echo 4 > /proc/sys/vm/drop_caches + +To enable informational:: + + echo 0 > /proc/sys/vm/drop_caches + enable_soft_offline ===================
fs/drop_caches.c +6 -3
@@ -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 silent;if (sysctl_drop_caches &1 ) {lru_add_drain_all ();
@@ -68,12 +68,15 @@ int drop_caches_sysctl_handler(const struct ctl_table *table, int write,drop_slab ();count_vm_event (DROP_SLAB ); } -if (!stfu) { +if (!silent) {pr_info ("%s (%d): drop_caches: %d\n" , current->comm,task_pid_nr (current), sysctl_drop_caches); } - stfu |= sysctl_drop_caches &4 ; +if (sysctl_drop_caches ==0 ) + silent = false; +else if (sysctl_drop_caches ==4 ) + silent = true; }return 0 ; }
kernel/sysctl.c +1 -1
@@ -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, }, {
Signature · 1 line
2.27.0
Joel Granados
maintainerQuoted 41 lines · Ruiwu Chen
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 <[email protected]>--- fs/drop_caches.c | 7 +++++-- kernel/sysctl.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-)fs/drop_caches.c +5
-2@@ -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;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 ; }kernel/sysctl.c +0
-0
kernel/sysctl.c static const struct ctl_table vm_table[] = { · line 2092
Quoted 6 lines
kernel/sysctl.c +1
-1@@ -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,
note that vm_table will no longer exist in the next version. Please rebase this on top of sysctl-next
Best
Quoted 5 lines
kernel/sysctl.c +0
-0}, {Signature · 1 line
2.27.0
Signature · 1 line
Joel Granados