[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190806085605.GL11812@dhcp22.suse.cz>
Date: Tue, 6 Aug 2019 10:56:05 +0200
From: Michal Hocko <mhocko@...nel.org>
To: "Joel Fernandes (Google)" <joel@...lfernandes.org>
Cc: linux-kernel@...r.kernel.org,
Alexey Dobriyan <adobriyan@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Borislav Petkov <bp@...en8.de>,
Brendan Gregg <bgregg@...flix.com>,
Catalin Marinas <catalin.marinas@....com>,
Christian Hansen <chansen3@...co.com>, dancol@...gle.com,
fmayer@...gle.com, "H. Peter Anvin" <hpa@...or.com>,
Ingo Molnar <mingo@...hat.com>, joelaf@...gle.com,
Jonathan Corbet <corbet@....net>,
Kees Cook <keescook@...omium.org>, kernel-team@...roid.com,
linux-api@...r.kernel.org, linux-doc@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
Mike Rapoport <rppt@...ux.ibm.com>, minchan@...nel.org,
namhyung@...gle.com, paulmck@...ux.ibm.com,
Robin Murphy <robin.murphy@....com>,
Roman Gushchin <guro@...com>,
Stephen Rothwell <sfr@...b.auug.org.au>, surenb@...gle.com,
Thomas Gleixner <tglx@...utronix.de>, tkjos@...gle.com,
Vladimir Davydov <vdavydov.dev@...il.com>,
Vlastimil Babka <vbabka@...e.cz>, Will Deacon <will@...nel.org>
Subject: Re: [PATCH v4 1/5] mm/page_idle: Add per-pid idle page tracking
using virtual indexing
On Mon 05-08-19 13:04:47, Joel Fernandes (Google) wrote:
> The page_idle tracking feature currently requires looking up the pagemap
> for a process followed by interacting with /sys/kernel/mm/page_idle.
> Looking up PFN from pagemap in Android devices is not supported by
> unprivileged process and requires SYS_ADMIN and gives 0 for the PFN.
>
> This patch adds support to directly interact with page_idle tracking at
> the PID level by introducing a /proc/<pid>/page_idle file. It follows
> the exact same semantics as the global /sys/kernel/mm/page_idle, but now
> looking up PFN through pagemap is not needed since the interface uses
> virtual frame numbers, and at the same time also does not require
> SYS_ADMIN.
>
> In Android, we are using this for the heap profiler (heapprofd) which
> profiles and pin points code paths which allocates and leaves memory
> idle for long periods of time. This method solves the security issue
> with userspace learning the PFN, and while at it is also shown to yield
> better results than the pagemap lookup, the theory being that the window
> where the address space can change is reduced by eliminating the
> intermediate pagemap look up stage. In virtual address indexing, the
> process's mmap_sem is held for the duration of the access.
As already mentioned in one of the previous versions. The interface
seems sane and the usecase as well. So I do not really have high level
objections.
>From a quick look at the patch I would just object to pulling swap idle
tracking into this patch because it makes the review harder and it is
essentially a dead code until a later patch. I am also not sure whether
that is really necessary and it really begs for an explicit
justification.
I will try to go through the patch more carefully later as time allows.
> Signed-off-by: Joel Fernandes (Google) <joel@...lfernandes.org>
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists