Re: [PATCH] mm/mincore: allow for making sys_mincore() privileged

From: Kirill A. Shutemov
Date: Tue Jan 08 2019 - 09:09:27 EST


On Tue, Jan 08, 2019 at 02:53:00PM +0100, Bernd Petrovitsch wrote:
> On 08/01/2019 12:37, Jiri Kosina wrote:
> > On Tue, 8 Jan 2019, Bernd Petrovitsch wrote:
> >
> >> Shouldn't the application use e.g. mlock()/.... to guarantee no page
> >> faults in the first place?
> >
> > Calling mincore() on pages you've just mlock()ed is sort of pointless
> > though.
>
> Obviously;-)
>
> Sorry for being unclear above: If I want my application to
> avoid suffering from page faults, I use simply mlock()
> (and/or friends) to nail the relevant pages into physical
> RAM and not "look if they are out, if yes, get them in" which
> has also the risk that these important pages are too soon
> evicted again.

Note, that mlock() doesn't prevent minor page faults. Mlocked memory is
still subject to mechanisms that makes the page temporary unmapped. For
instance migration (including NUMA balancing), compaction, khugepaged...

--
Kirill A. Shutemov