Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1319705

Re: [PATCH] mm: do not let vdso pages into LRU rotation

From Andy Lutomirski <luto@amacapital.net>
Newsgroups linux.kernel
Subject Re: [PATCH] mm: do not let vdso pages into LRU rotation
Date 2016-01-27 21:40 +0100
Message-ID <qVF2G-Kd-15@gated-at.bofh.it> (permalink)
References <qVEgk-6M-59@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Jan 27, 2016 at 11:39 AM, Johannes Weiner <hannes@cmpxchg.org> wrote:
> Hi,
>
> I noticed that vdso pages are faulted and unmapped as if they were
> regular file pages. And I'm guessing this is so that the vdso mappings
> are able to use the generic COW code in memory.c.
>
> However, it's a little unsettling that zap_pte_range() makes decisions
> based on PageAnon() and the page even reaches mark_page_accessed(), as
> that function makes several assumptions about the page being a regular
> LRU user page. It seems this isn't crashing today by sheer luck, but I
> am working on code that does when page_is_file_cache() returns garbage.
>
> I'm using this hack to work around it:
>
> diff --git a/mm/memory.c b/mm/memory.c
> index c387430f06c3..f0537c500150 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -1121,7 +1121,8 @@ again:
>                                         set_page_dirty(page);
>                                 }
>                                 if (pte_young(ptent) &&
> -                                   likely(!(vma->vm_flags & VM_SEQ_READ)))
> +                                   likely(!(vma->vm_flags & VM_SEQ_READ)) &&
> +                                   !PageReserved(page))
>                                         mark_page_accessed(page);
>                                 rss[MM_FILEPAGES]--;
>                         }
>
> but I think we need a cleaner (and more robust) solution there to make
> it clearer that these pages are not regularly managed pages.
>
> Could the VDSO be a VM_MIXEDMAP to keep the initial unmanaged pages
> out of the VM while allowing COW into regular anonymous pages?

Probably.  What are its limitations?  We want ptrace to work on it,
and mprotect needs to work and allow COW.  access_process_vm should
probably work, too.

>
> Are there other requirements of the VDSO that I might be missing?

There's vvar, too, on x86_64, and that mapping is really strange.
It's different in -tip than in any released kernel, too.  VM_MIXEDMAP
seems to work.

If you want to improve this, take a look at -tip -- it's cleaned up a lot.

--Andy

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] mm: do not let vdso pages into LRU rotation Johannes Weiner <hannes@cmpxchg.org> - 2016-01-27 20:50 +0100
  Re: [PATCH] mm: do not let vdso pages into LRU rotation Andy Lutomirski <luto@amacapital.net> - 2016-01-27 21:40 +0100
    Re: [PATCH] mm: do not let vdso pages into LRU rotation Johannes Weiner <hannes@cmpxchg.org> - 2016-01-28 22:40 +0100
      Re: [PATCH] mm: do not let vdso pages into LRU rotation Andy Lutomirski <luto@amacapital.net> - 2016-01-29 23:30 +0100

csiph-web