Re: [PATCH 4/4] oom-reaper: use madvise_dontneed() instead of unmap_page_range()

From: Michal Hocko
Date: Mon Dec 19 2016 - 09:38:47 EST


On Fri 16-12-16 17:15:56, Kirill A. Shutemov wrote:
> Logic on whether we can reap pages from the VMA should match what we
> have in madvise_dontneed(). In particular, we should skip, VM_PFNMAP
> VMAs, but we don't now.
>
> Let's just call madvise_dontneed() from __oom_reap_task_mm(), so we
> won't need to sync the logic in the future.

I would rather extract those check into can_madv_dontneed_vma() and use
it in the oom reaper. I am really woried about notifier API which can
sleep or rely on locks or do whatever else.

--
Michal Hocko
SUSE Labs