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

From: Matthew Wilcox
Date: Sat Jan 05 2019 - 19:11:52 EST


On Sat, Jan 05, 2019 at 03:39:10PM -0800, Linus Torvalds wrote:
> On Sat, Jan 5, 2019 at 3:16 PM Linus Torvalds
> <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > It goes back to forever, it looks like. I can't find a reason.
>
> mincore() was originally added in 2.3.52pre3, it looks like. Around
> 2000 or so. But sadly before the BK history.
>
> And that comment about
>
> "Later we can get more picky about what "in core" means precisely."
>
> that still exists above mincore_page() goes back to the original patch.

FreeBSD claims to have a manpage from SunOS 4.1.3 with mincore (!)

https://www.freebsd.org/cgi/man.cgi?query=mincore&apropos=0&sektion=0&manpath=SunOS+4.1.3&arch=default&format=html

DESCRIPTION
mincore() returns the primary memory residency status of pages in the
address space covered by mappings in the range [addr, addr + len). The
status is returned as a char-per-page in the character array referenced
by *vec (which the system assumes to be large enough to encompass all
the pages in the address range). The least significant bit of each
character is set to 1 to indicate that the referenced page is in pri-
mary memory, 0 if it is not. The settings of other bits in each char-
acter is undefined and may contain other information in the future.