]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mm: introduce vma_is_anonymous(vma) helper
authorOleg Nesterov <oleg@redhat.com>
Tue, 8 Sep 2015 21:58:28 +0000 (14:58 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 20 Jun 2019 17:11:26 +0000 (18:11 +0100)
commit762d8ea0c73165fc9c99a9bc63b82706cbb56062
tree2c06ccb85a868c64d0412b9133d8b2b9b7c51675
parenta16bfc08c3a853298eb7122c6ea94336b7eeede2
mm: introduce vma_is_anonymous(vma) helper

commit b5330628546616af14ff23075fbf8d4ad91f6e25 upstream.

special_mapping_fault() is absolutely broken.  It seems it was always
wrong, but this didn't matter until vdso/vvar started to use more than
one page.

And after this change vma_is_anonymous() becomes really trivial, it
simply checks vm_ops == NULL.  However, I do think the helper makes
sense.  There are a lot of ->vm_ops != NULL checks, the helper makes the
caller's code more understandable (self-documented) and this is more
grep-friendly.

This patch (of 3):

Preparation.  Add the new simple helper, vma_is_anonymous(vma), and change
handle_pte_fault() to use it.  It will have more users.

The name is not accurate, say a hpet_mmap()'ed vma is not anonymous.
Perhaps it should be named vma_has_fault() instead.  But it matches the
logic in mmap.c/memory.c (see next changes).  "True" just means that a
page fault will use do_anonymous_page().

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[bwh: Backported to 3.16 as dependency of "mm/mincore.c: make mincore() more
 conservative"; adjusted context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
include/linux/mm.h
mm/memory.c