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

From: Minchan Kim
Date: Tue Mar 10 2020 - 18:20:15 EST


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.

>
> > 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.

>
> > Instead,
> > it is known to the centralized userspace daemon(ActivityManagerService),
> > and that daemon must be able to initiate reclaim on its own without
> > any app involvement.
> >
> > To solve the issue, this patch introduces a new syscall process_madvise(2).
> > It uses pidfd of an external process to give the hint.
> >
> > int process_madvise(int pidfd, void *addr, size_t length, int advise,
> > unsigned long flag);
>
> It's more common to call the argument 'flags' not 'flag'? The code seems to call
> it flags. Also in line with madvise(2), the 'advise' argument should rather be
> 'advice'. This is more important for the manpage, but let's be consistent.

Yub, I will send the patch along with your comment in previous patch.

>
> ...
>
> >
> > Reviewed-by: Suren Baghdasaryan <surenb@xxxxxxxxxx>
> > Signed-off-by: Minchan Kim <minchan@xxxxxxxxxx>
>
> For the core parts,
> Reviewed-by: Vlastimil Babka <vbabka@xxxxxxx>

Thanks for the review!