[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5jLPT-2c_H3kjCzbVgRKQO0xMskVd7JcAMmWZSmFgzZ4ng@mail.gmail.com>
Date: Mon, 27 Jul 2015 12:18:57 -0700
From: Kees Cook <keescook@...omium.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Vladimir Davydov <vdavydov@...allels.com>,
Andres Lagar-Cavilla <andreslc@...gle.com>,
Minchan Kim <minchan@...nel.org>,
Raghavendra K T <raghavendra.kt@...ux.vnet.ibm.com>,
Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...e.cz>,
Greg Thelen <gthelen@...gle.com>,
Michel Lespinasse <walken@...gle.com>,
David Rientjes <rientjes@...gle.com>,
Pavel Emelyanov <xemul@...allels.com>,
Cyrill Gorcunov <gorcunov@...nvz.org>,
Jonathan Corbet <corbet@....net>,
Linux API <linux-api@...r.kernel.org>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
Linux-MM <linux-mm@...ck.org>, Cgroups <cgroups@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -mm v9 0/8] idle memory tracking
On Tue, Jul 21, 2015 at 4:34 PM, Andrew Morton
<akpm@...ux-foundation.org> wrote:
> On Sun, 19 Jul 2015 15:31:09 +0300 Vladimir Davydov <vdavydov@...allels.com> wrote:
>> To mark a page idle one should set the bit corresponding to the
>> page by writing to the file. A value written to the file is OR-ed with the
>> current bitmap value. Only user memory pages can be marked idle, for other
>> page types input is silently ignored. Writing to this file beyond max PFN
>> results in the ENXIO error. Only available when CONFIG_IDLE_PAGE_TRACKING is
>> set.
>>
>> This file can be used to estimate the amount of pages that are not
>> used by a particular workload as follows:
>>
>> 1. mark all pages of interest idle by setting corresponding bits in the
>> /proc/kpageidle bitmap
>> 2. wait until the workload accesses its working set
>> 3. read /proc/kpageidle and count the number of bits set
>
> Security implications. This interface could be used to learn about a
> sensitive application by poking data at it and then observing its
> memory access patterns. Perhaps this is why the proc files are
> root-only (whcih I assume is sufficient). Some words here about the
> security side of things and the reasoning behind the chosen permissions
> would be good to have.
As long as this stays true-root-only, I think it should be safe enough.
>> * /proc/kpagecgroup. This file contains a 64-bit inode number of the
>> memory cgroup each page is charged to, indexed by PFN.
>
> Actually "closest online ancestor". This also should be in the
> interface documentation.
>
>> Only available when CONFIG_MEMCG is set.
>
> CONFIG_MEMCG and CONFIG_IDLE_PAGE_TRACKING I assume?
>
>>
>> This file can be used to find all pages (including unmapped file
>> pages) accounted to a particular cgroup. Using /proc/kpageidle, one
>> can then estimate the cgroup working set size.
>>
>> For an example of using these files for estimating the amount of unused
>> memory pages per each memory cgroup, please see the script attached
>> below.
>
> Why were these put in /proc anyway? Rather than under /sys/fs/cgroup
> somewhere? Presumably because /proc/kpageidle is useful in non-memcg
> setups.
Do we need a /proc/vm/ for holding these kinds of things? We're
collecting a lot there. Or invent some way for this to be sensible in
/sys?
-Kees
--
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists