All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maksym Planeta <mcsim.planeta@gmail.com>
To: dedekind1@gmail.com
Cc: Thomas Knauth <thomas.knauth@gmx.de>,
	David Rientjes <rientjes@google.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sysctl: Add a feature to drop caches selectively
Date: Thu, 26 Jun 2014 11:30:34 +0200	[thread overview]
Message-ID: <CAM3PqV6NFkjfBEm25V6WScxCvAvTFNkhCYJv+GAvFJ5pZ_E-Zw@mail.gmail.com> (raw)
In-Reply-To: <1403703728.20275.33.camel@sauron.fi.intel.com>

> With a binary interface like an ioctl I can see how you could have extra
> unused fields which you can ignore now and let people start adding extra
> options like the range in the future.

Yes, ioctl is another possibility. But I would argue that sysctl is
more convenient interface, because idea of sdrop_caches is similar to
drop_caches's one and it is convenient to have these interfaces in the
same place. But if sdrop_caches uses procfs it seems that there is no
easy way to pass parameters of different types in one write operation.

> Other questions I'd ask would be - how about the access control model?
> Will only root be able to drop caches? Why can't I drop caches for my
> own file?

Access control model is the same as for drop_caches. This means that
only root can write to this file. But it is easy to add a feature that
allows any user to clean page cache of inodes that this user owns.

2014-06-25 15:42 GMT+02:00 Artem Bityutskiy <dedekind1@gmail.com>:
> On Wed, 2014-06-25 at 15:23 +0200, Thomas Knauth wrote:
>> On Wed, Jun 25, 2014 at 11:56 AM, Artem Bityutskiy <dedekind1@gmail.com> wrote:
>> > Thanks for the answer, although you forgot to comment on the question
>> > about possibly extending the new interface to work with file ranges in
>> > the future. For example, I have a 2 TiB file, and I am only interested
>> > in dropping caches for the first couple of gigabytes. Would I extend
>> > your interface, or would I come up with another one?
>>
>> Ah, didn't quite understand what was meant with file ranges. Again, we
>> had not considered this so far. I guess you could make a distinction
>> between directories and files here. If the path points to a file, you
>> can have an optional argument indicating the range of bytes you would
>> like to drop. Something like
>>
>> echo "my-file 0-1000,8000-1000" > /proc/sys/vm/sdrop_cache
>>
>> If this is desirable, we can add it to the patch.
>
> With a binary interface like an ioctl I can see how you could have extra
> unused fields which you can ignore now and let people start adding extra
> options like the range in the future.
>
> With this kind of interface I am not sure how to do this.
>
> Other questions I'd ask would be - how about the access control model?
> Will only root be able to drop caches? Why can't I drop caches for my
> own file?
>
> I did not put much thinking into this, but it looks like ioctl could be
> a better interface for the task you are trying to solve...
>
> Sorry if I am a bit vague, I am mostly trying to make you guys give this
> more thoughts, and come up with a deeper analysis. Interfaces are very
> important to get right, or as right as possible...
>
> --
> Best Regards,
> Artem Bityutskiy
>



-- 
Regards,
Maksym Planeta.

  reply	other threads:[~2014-06-26  9:30 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-24 16:10 [PATCH] sysctl: Add a feature to drop caches selectively Maksym Planeta
2014-06-24 21:59 ` David Rientjes
2014-06-25  6:25   ` Artem Bityutskiy
2014-06-25  8:25     ` Thomas Knauth
2014-06-25  9:56       ` Artem Bityutskiy
2014-06-25 13:23         ` Thomas Knauth
2014-06-25 13:30           ` Artem Bityutskiy
2014-06-25 13:42           ` Artem Bityutskiy
2014-06-26  9:30             ` Maksym Planeta [this message]
2014-06-25 10:03       ` Artem Bityutskiy
2014-06-25 13:19         ` Thomas Knauth
2014-06-25 22:15       ` Pavel Machek
2014-06-26  1:06       ` Dave Chinner
2014-06-26  6:13         ` Artem Bityutskiy
2014-06-26 10:36           ` Bernd Schubert
2014-06-26 11:31             ` Artem Bityutskiy
2014-06-26 11:57               ` Lukáš Czerner
2014-06-26 12:10                 ` Bernd Schubert
2014-06-27  2:55                   ` Dave Chinner
2014-06-27  2:55                     ` Dave Chinner
2014-06-27  8:58                     ` Bernd Schubert
2014-06-27  8:41                 ` Matthias Schniedermeyer
2014-06-27  9:04                   ` Lukáš Czerner
2014-06-27  9:08                   ` Artem Bityutskiy
2014-06-27  9:08                     ` Artem Bityutskiy
2014-06-27  9:09                     ` Bityutskiy, Artem
2014-06-27  9:09                       ` Bityutskiy, Artem
2014-06-27  2:48           ` Dave Chinner
     [not found] <CACVxJT_6sp=KDy=jCNBypYapKv_59W8LxFU4OiJEm6gt_SuZKg@mail.gmail.com>
2014-06-25 11:21 ` Alexey Dobriyan

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=CAM3PqV6NFkjfBEm25V6WScxCvAvTFNkhCYJv+GAvFJ5pZ_E-Zw@mail.gmail.com \
    --to=mcsim.planeta@gmail.com \
    --cc=dedekind1@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rientjes@google.com \
    --cc=thomas.knauth@gmx.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.