lkml.org 
[lkml]   [2014]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [patch] drop_caches: add some documentation and info message
On Fri, 7 Feb 2014 13:13:32 -0500 Johannes Weiner <hannes@cmpxchg.org> wrote:

> @@ -63,6 +64,9 @@ int drop_caches_sysctl_handler(ctl_table *table, int write,
> iterate_supers(drop_pagecache_sb, NULL);
> if (sysctl_drop_caches & 2)
> drop_slab();
> + printk_ratelimited(KERN_INFO "%s (%d): dropped kernel caches: %d\n",
> + current->comm, task_pid_nr(current),
> + sysctl_drop_caches);
> }
> return 0;
> }

My concern with this is that there may be people whose
other-party-provided software uses drop_caches. Their machines will
now sit there emitting log messages and there's nothing they can do
about it, apart from whining at their vendors.


We could do something like this?

--- a/fs/drop_caches.c~drop_caches-add-some-documentation-and-info-message-fix
+++ a/fs/drop_caches.c
@@ -60,13 +60,17 @@ int drop_caches_sysctl_handler(ctl_table
if (ret)
return ret;
if (write) {
+ static int stfu;
+
if (sysctl_drop_caches & 1)
iterate_supers(drop_pagecache_sb, NULL);
if (sysctl_drop_caches & 2)
drop_slab();
- printk_ratelimited(KERN_INFO "%s (%d): dropped kernel caches: %d\n",
- current->comm, task_pid_nr(current),
- sysctl_drop_caches);
+ stfu |= sysctl_drop_caches & 4;
+ if (!stfu)
+ pr_info_ratelimited("%s (%d): dropped kernel caches: %d\n",
+ current->comm, task_pid_nr(current),
+ sysctl_drop_caches);
}
return 0;
}
_
(note switch to pr_info_ratelimited)


\
 
 \ /
  Last update: 2014-02-07 21:41    [W:0.062 / U:2.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site