Re: [PATCH v7 2/7] mm: introduce external memory hinting API

From: Minchan Kim
Date: Thu Mar 12 2020 - 16:23:46 EST


On Thu, Mar 12, 2020 at 01:40:26PM +0100, Vlastimil Babka wrote:
> On 3/10/20 11:20 PM, Minchan Kim wrote:
> > On Thu, Mar 05, 2020 at 07:15:10PM +0100, Vlastimil Babka wrote:
> >> On 3/2/20 8:36 PM, Minchan Kim wrote:
> >> > There is usecase that System Management Software(SMS) want to give
> >> > a memory hint like MADV_[COLD|PAGEEOUT] to other processes and
> >> > in the case of Android, it is the ActivityManagerService.
> >> >
> >> > It's similar in spirit to madvise(MADV_WONTNEED), but the information
> >>
> >> You mean MADV_DONTNEED?
> >
> > Mean to DONT_NEED's future version.
>
> What's that exactly?

For zapping timing point of view, dontneed acts immediately so it's very
strong hint. However, MADV_COLD and MADV_PAGEOUT does lazily depending
on the future. For example, the page never discarded if it's touched
before the tail of LRU. If other process which shared the page has
touched the page, never paging out.

>
> >>
> >> > required to make the reclaim decision is not known to the app.
> >>
> >> This seems to be mixing up the differences between MADV_DONTNEED and
> >> COLD/PAGEOUT and self-imposed vs external memory hints?
> >
> > Sorry, I don't understand what you want here.
>
> You say that process_madvise(MADV_[COLD|PAGEEOUT]) is similar to
> madvise(MADV_WONTNEED) but the difference is that the information
> required to make the reclaim decision is not known to the app.
>
> I see two differences. One is madvise vs process_madvise, which is explained by
> "reclaim decision is not known to the app."
> The other is MADV_WONTNEED vs MADV_[COLD|PAGEEOUT], which is... I'm not sure
> until you say what's "DONT_NEED's future version" :D
>
> Anyway I assume this part is from the versions where the new COLD and PAGEOUT
> flags were introduced together with external memory hinting API?

Exactly. Maybe it would be better to remove the part once we merged the
COLD and PAGEOUT now.

Thanks for the review, Vlastimil!