Re: [PATCH resend] drop_caches: add some documentation and infomessage

From: Rob Landley
Date: Fri Aug 02 2013 - 12:04:17 EST


On 07/31/2013 10:17:08 PM, Andrew Morton wrote:
On Wed, 31 Jul 2013 23:11:50 -0400 KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx> wrote:

> >> --- a/fs/drop_caches.c
> >> +++ b/fs/drop_caches.c
> >> @@ -59,6 +59,8 @@ int drop_caches_sysctl_handler(ctl_table *table, int write,
> >> if (ret)
> >> return ret;
> >> if (write) {
> >> + printk(KERN_INFO "%s (%d): dropped kernel caches: %d\n",
> >> + current->comm, task_pid_nr(current), sysctl_drop_caches);
> >> if (sysctl_drop_caches & 1)
> >> iterate_supers(drop_pagecache_sb, NULL);
> >> if (sysctl_drop_caches & 2)
> >
> > How about we do
> >
> > if (!(sysctl_drop_caches & 4))
> > printk(....)
> >
> > so people can turn it off if it's causing problems?
>
> The best interface depends on the purpose. If you want to detect crazy application,
> we can't assume an application co-operate us. So, I doubt this works.

You missed the "!". I'm proposing that setting the new bit 2 will
permit people to prevent the new printk if it is causing them problems.

Or an alternative for those planning to patch it down to a KERN_DEBUG locally.

I'd be surprised if anybody who does this sees the printk and thinks "hey, I'll dig into the VM's balancing logic and come up to speed on the tradeoffs sufficient to contribute to kernel development" because of something in dmesg. Anybody actually annoyed by it will chop out the printk (you barely need to know C to do that), the rest won't notice.

Rob--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/