linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrea Righi <andrea@betterlinux.com>
To: Joel Becker <jlbec@evilplan.org>
Cc: Dave Chinner <david@fromorbit.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>, Arnd Bergmann <arnd@arndb.de>,
	linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC] [PATCH] drop_pagecache syscall
Date: Fri, 29 Apr 2011 10:18:32 +0200	[thread overview]
Message-ID: <20110429081832.GA1465@linux.develer.com> (raw)
In-Reply-To: <20110428232210.GA4132@noexit.corp.google.com>

On Thu, Apr 28, 2011 at 04:22:10PM -0700, Joel Becker wrote:
> On Wed, Apr 27, 2011 at 11:01:28AM +0200, Andrea Righi wrote:
> > On Wed, Apr 27, 2011 at 10:14:53AM +1000, Dave Chinner wrote:
> > > On Tue, Apr 26, 2011 at 11:35:27PM +0200, Andrea Righi wrote:
> > > > Introduce sys_drop_pagecache() system call to drop the page cache pages of
> > > > a single filesystem.
> <snip>
> > > > This functionality can be used by all the applications that want to have a
> > > > better control over the page cache management (for example to immediately drop
> > > > pages that for sure will not be reused in the near future, without calling
> > > > posix_fadvise() for all the files they've touched), or to provide a more fine
> > > > grained debugging feature usable by the filesystem benchmarks.
> > > > 
> > > > The system call does not require root privileges and it can be called by any
> > > > unprivileged application. For example, we can write a userspace tool to run
> > > > something like this:
> > > > 
> > > >   $ drop-pagecache /path/file_or_dir
> > > 
> > > That's a potential DOS vector, I think. Drop the pagecache in a hard
> > > loop on the root fs of a busy server and watch it crawl...
> > 
> > Yes, probably we could allow only the CAP_SYS_ADMIN tasks to execute
> > this syscall.
> 
> 	The majority of apps that want this do not run as root.  Do we
> want them all setuid?  ;-)

Another solution could be to limit the rate of this syscall if executed
by a non-privileged user. And the rate limit could be also configurable
from userspace via /proc/sys/vm/ or something similar.

-Andrea

      reply	other threads:[~2011-04-29  8:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-26 21:35 [RFC] [PATCH] drop_pagecache syscall Andrea Righi
2011-04-27  0:14 ` Dave Chinner
2011-04-27  9:01   ` Andrea Righi
2011-04-27  9:10     ` Mike Frysinger
2011-04-27  9:47       ` Andrea Righi
2011-04-27  9:50         ` Mike Frysinger
2011-04-27  9:57           ` Andrea Righi
2011-04-27 15:25             ` Mike Frysinger
2011-04-27 15:42               ` Andrea Righi
2011-04-28 23:22     ` Joel Becker
2011-04-29  8:18       ` Andrea Righi [this message]

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=20110429081832.GA1465@linux.develer.com \
    --to=andrea@betterlinux.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=david@fromorbit.com \
    --cc=jlbec@evilplan.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).