Pavel Tatashin
dfb3ccd00a
mm: make memmap_init a proper function
...
memmap_init is sometimes a macro sometimes a function based on
__HAVE_ARCH_MEMMAP_INIT. It is only a function on ia64. Make memmap_init
a weak function instead, and let ia64 redefine it.
Link: http://lkml.kernel.org/r/20180724235520.10200-2-pasha.tatashin@oracle.com
Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Oscar Salvador <osalvador@suse.de >
Cc: Steven Sistare <steven.sistare@oracle.com >
Cc: Daniel Jordan <daniel.m.jordan@oracle.com >
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Jan Kara <jack@suse.cz >
Cc: Jérôme Glisse <jglisse@redhat.com >
Cc: Souptick Joarder <jrdr.linux@gmail.com >
Cc: Baoquan He <bhe@redhat.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Vlastimil Babka <vbabka@suse.cz >
Cc: Wei Yang <richard.weiyang@gmail.com >
Cc: Dave Hansen <dave.hansen@intel.com >
Cc: David Rientjes <rientjes@google.com >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Pavel Tatashin <pasha.tatashin@oracle.com >
Cc: Abdul Haleem <abdhalee@linux.vnet.ibm.com >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Pasha Tatashin <Pavel.Tatashin@microsoft.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:35 -07:00
Kirill Tkhai
1c2d479a11
mm/memcontrol.c: convert mem_cgroup_id::ref to refcount_t type
...
This will allow to use generic refcount_t interfaces to check counters
overflow instead of currently existing VM_BUG_ON(). The only difference
after the patch is VM_BUG_ON() may cause BUG(), while refcount_t fires
with WARN(). But this seems not to be significant here, since such the
problems are usually caught by syzbot with panic-on-warn enabled.
Link: http://lkml.kernel.org/r/153910718919.7006.13400779039257185427.stgit@localhost.localdomain
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Acked-by: Michal Hocko <mhocko@suse.com >
Cc: Johannes Weiner <hannes@cmpxchg.org >
Cc: Vladimir Davydov <vdavydov.dev@gmail.com >
Cc: Andrea Parri <andrea.parri@amarulasolutions.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:35 -07:00
David Rientjes
4a222127f3
mm/page_alloc.c: initialize num_movable in move_freepages()
...
If move_freepages_block() returns 0 because !zone_spans_pfn(),
*num_movable can hold the value from the stack because it does not get
initialized in move_freepages().
Move the initialization to move_freepages_block() to guarantee the value
actually makes sense.
This currently doesn't affect its only caller where num_movable != NULL,
so no bug fix, but just more robust.
Link: http://lkml.kernel.org/r/alpine.DEB.2.21.1810051355490.212229@chino.kir.corp.google.com
Signed-off-by: David Rientjes <rientjes@google.com >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Acked-by: Vlastimil Babka <vbabka@suse.cz >
Cc: Greg Thelen <gthelen@google.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:35 -07:00
Gustavo A. R. Silva
61855f021c
mm/zsmalloc.c: fix fall-through annotation
...
Replace "fallthru" with a proper "fall through" annotation.
This fix is part of the ongoing efforts to enabling
-Wimplicit-fallthrough
Link: http://lkml.kernel.org/r/20181003105114.GA24423@embeddedor.com
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com >
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com >
Cc: Minchan Kim <minchan@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:35 -07:00
Peter Xu
7eaa8c969e
userfaultfd: selftest: recycle lock threads first
...
Now we recycle the uffd servicing threads earlier than the lock threads.
It might happen that when the lock thread is still blocked at a pthread
mutex lock while the servicing thread has already quitted for the cpu so
the lock thread will be blocked forever and hang the test program. To fix
the possible race, recycle the lock threads first.
This never happens with current missing-only tests, but when I start to
run the write-protection tests (the feature is not yet posted upstream) it
happens every time of the run possibly because in that new test we'll need
to service two page faults for each lock operation.
Link: http://lkml.kernel.org/r/20180930074259.18229-4-peterx@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com >
Acked-by: Mike Rapoport <rppt@linux.vnet.ibm.com >
Cc: Shuah Khan <shuah@kernel.org >
Cc: Mike Kravetz <mike.kravetz@oracle.com >
Cc: Jerome Glisse <jglisse@redhat.com >
Cc: Zi Yan <zi.yan@cs.rutgers.edu >
Cc: "Kirill A . Shutemov" <kirill@shutemov.name >
Cc: Shaohua Li <shli@fb.com >
Cc: Andrea Arcangeli <aarcange@redhat.com >
Cc: "Dr . David Alan Gilbert" <dgilbert@redhat.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:35 -07:00
Peter Xu
04d877319e
userfaultfd: selftest: generalize read and poll
...
We do very similar things in read and poll modes, but we're copying the
codes around. Share the codes properly on reading the message and
handling the page fault to make the code cleaner. Meanwhile this solves
previous mismatch of behaviors between the two modes on that the old code:
- did not check EAGAIN case in read() mode
- ignored BOUNCE_VERIFY check in read() mode
Link: http://lkml.kernel.org/r/20180930074259.18229-3-peterx@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com >
Acked-by: Mike Rapoport <rppt@linux.vnet.ibm.com >
Cc: Shuah Khan <shuah@kernel.org >
Cc: Mike Kravetz <mike.kravetz@oracle.com >
Cc: Jerome Glisse <jglisse@redhat.com >
Cc: Zi Yan <zi.yan@cs.rutgers.edu >
Cc: "Kirill A . Shutemov" <kirill@shutemov.name >
Cc: Shaohua Li <shli@fb.com >
Cc: Andrea Arcangeli <aarcange@redhat.com >
Cc: "Dr . David Alan Gilbert" <dgilbert@redhat.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:35 -07:00
Peter Xu
439de0d744
userfaultfd: selftest: cleanup help messages
...
Firstly, the help in the comment region is obsolete, now we support
three parameters. Since at it, change it and move it into the help
message of the program.
Also, the help messages dumped here and there is obsolete too. Use a
single usage() helper.
Link: http://lkml.kernel.org/r/20180930074259.18229-2-peterx@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com >
Acked-by: Mike Rapoport <rppt@linux.vnet.ibm.com >
Cc: Shuah Khan <shuah@kernel.org >
Cc: Mike Kravetz <mike.kravetz@oracle.com >
Cc: Jerome Glisse <jglisse@redhat.com >
Cc: Zi Yan <zi.yan@cs.rutgers.edu >
Cc: "Kirill A . Shutemov" <kirill@shutemov.name >
Cc: Shaohua Li <shli@fb.com >
Cc: Andrea Arcangeli <aarcange@redhat.com >
Cc: "Dr . David Alan Gilbert" <dgilbert@redhat.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:35 -07:00
Jann Horn
f0ecf25a09
mm/vmstat.c: assert that vmstat_text is in sync with stat_items_size
...
Having two gigantic arrays that must manually be kept in sync, including
ifdefs, isn't exactly robust. To make it easier to catch such issues in
the future, add a BUILD_BUG_ON().
Link: http://lkml.kernel.org/r/20181001143138.95119-3-jannh@google.com
Signed-off-by: Jann Horn <jannh@google.com >
Reviewed-by: Kees Cook <keescook@chromium.org >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Acked-by: Roman Gushchin <guro@fb.com >
Acked-by: Michal Hocko <mhocko@suse.com >
Cc: Davidlohr Bueso <dave@stgolabs.net >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Christoph Lameter <clameter@sgi.com >
Cc: Kemi Wang <kemi.wang@intel.com >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Ingo Molnar <mingo@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:35 -07:00
Aneesh Kumar K.V
ff09d7ec97
mm/memory.c: recheck page table entry with page table lock held
...
We clear the pte temporarily during read/modify/write update of the pte.
If we take a page fault while the pte is cleared, the application can get
SIGBUS. One such case is with remap_pfn_range without a backing
vm_ops->fault callback. do_fault will return SIGBUS in that case.
cpu 0 cpu1
mprotect()
ptep_modify_prot_start()/pte cleared.
.
. page fault.
.
.
prep_modify_prot_commit()
Fix this by taking page table lock and rechecking for pte_none.
[aneesh.kumar@linux.ibm.com: fix crash observed with syzkaller run]
Link: http://lkml.kernel.org/r/87va6bwlfg.fsf@linux.ibm.com
Link: http://lkml.kernel.org/r/20180926031858.9692-1-aneesh.kumar@linux.ibm.com
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com >
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com >
Cc: Eric Dumazet <eric.dumazet@gmail.com >
Cc: Ido Schimmel <idosch@idosch.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:35 -07:00
Yang Shi
cc4b8c794f
mm: dax: add comment for PFN_SPECIAL
...
The comment for PFN_SPECIAL is missed in pfn_t.h. Add comment to get
consistent with other pfn flags.
Link: http://lkml.kernel.org/r/1538086549-100536-1-git-send-email-yang.shi@linux.alibaba.com
Signed-off-by: Yang Shi <yang.shi@linux.alibaba.com >
Suggested-by: Dan Williams <dan.j.williams@intel.com >
Reviewed-by: Dan Williams <dan.j.williams@intel.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:35 -07:00
Yang Shi
9bc8039e71
mm: brk: downgrade mmap_sem to read when shrinking
...
brk might be used to shrink memory mapping too other than munmap(). So,
it may hold write mmap_sem for long time when shrinking large mapping, as
what commit ("mm: mmap: zap pages with read mmap_sem in munmap")
described.
The brk() will not manipulate vmas anymore after __do_munmap() call for
the mapping shrink use case. But, it may set mm->brk after __do_munmap(),
which needs hold write mmap_sem.
However, a simple trick can workaround this by setting mm->brk before
__do_munmap(). Then restore the original value if __do_munmap() fails.
With this trick, it is safe to downgrade to read mmap_sem.
So, the same optimization, which downgrades mmap_sem to read for zapping
pages, is also feasible and reasonable to this case.
The period of holding exclusive mmap_sem for shrinking large mapping would
be reduced significantly with this optimization.
[akpm@linux-foundation.org: tweak comment]
[yang.shi@linux.alibaba.com: fix unsigned compare against 0 issue]
Link: http://lkml.kernel.org/r/1538687672-17795-1-git-send-email-yang.shi@linux.alibaba.com
Link: http://lkml.kernel.org/r/1538067582-60038-2-git-send-email-yang.shi@linux.alibaba.com
Signed-off-by: Yang Shi <yang.shi@linux.alibaba.com >
Acked-by: Vlastimil Babka <vbabka@suse.cz >
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Michal Hocko <mhocko@kernel.org >
Cc: Matthew Wilcox <willy@infradead.org >
Cc: Laurent Dufour <ldufour@linux.vnet.ibm.com >
Cc: Colin Ian King <colin.king@canonical.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:35 -07:00
Yang Shi
85a06835f6
mm: mremap: downgrade mmap_sem to read when shrinking
...
Other than munmap, mremap might be used to shrink memory mapping too.
So, it may hold write mmap_sem for long time when shrinking large
mapping, as what commit ("mm: mmap: zap pages with read mmap_sem in
munmap") described.
The mremap() will not manipulate vmas anymore after __do_munmap() call for
the mapping shrink use case, so it is safe to downgrade to read mmap_sem.
So, the same optimization, which downgrades mmap_sem to read for zapping
pages, is also feasible and reasonable to this case.
The period of holding exclusive mmap_sem for shrinking large mapping
would be reduced significantly with this optimization.
MREMAP_FIXED and MREMAP_MAYMOVE are more complicated to adopt this
optimization since they need manipulate vmas after do_munmap(),
downgrading mmap_sem may create race window.
Simple mapping shrink is the low hanging fruit, and it may cover the
most cases of unmap with munmap together.
[akpm@linux-foundation.org: tweak comment]
[yang.shi@linux.alibaba.com: fix unsigned compare against 0 issue]
Link: http://lkml.kernel.org/r/1538687672-17795-2-git-send-email-yang.shi@linux.alibaba.com
Link: http://lkml.kernel.org/r/1538067582-60038-1-git-send-email-yang.shi@linux.alibaba.com
Signed-off-by: Yang Shi <yang.shi@linux.alibaba.com >
Acked-by: Vlastimil Babka <vbabka@suse.cz >
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Michal Hocko <mhocko@kernel.org >
Cc: Matthew Wilcox <willy@infradead.org >
Cc: Laurent Dufour <ldufour@linux.vnet.ibm.com >
Cc: Colin Ian King <colin.king@canonical.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:35 -07:00
Souptick Joarder
3c0513243a
mm/filemap.c: use vmf_error()
...
These codes can be replaced with new inline vmf_error().
Link: http://lkml.kernel.org/r/20180927171411.GA23331@jordon-HP-15-Notebook-PC
Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Jan Kara <jack@suse.cz >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:35 -07:00
Alexandre Ghiti
544db7597a
hugetlb: introduce generic version of huge_ptep_get
...
ia64, mips, parisc, powerpc, sh, sparc, x86 architectures use the same
version of huge_ptep_get, so move this generic implementation into
asm-generic/hugetlb.h.
[arnd@arndb.de: fix ARM 3level page tables]
Link: http://lkml.kernel.org/r/20181005161722.904274-1-arnd@arndb.de
Link: http://lkml.kernel.org/r/20180920060358.16606-12-alex@ghiti.fr
Signed-off-by: Alexandre Ghiti <alex@ghiti.fr >
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com >
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com >
Tested-by: Helge Deller <deller@gmx.de > [parisc]
Acked-by: Catalin Marinas <catalin.marinas@arm.com > [arm64]
Acked-by: Paul Burton <paul.burton@mips.com > [MIPS]
Acked-by: Ingo Molnar <mingo@kernel.org > [x86]
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: David S. Miller <davem@davemloft.net >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Heiko Carstens <heiko.carstens@de.ibm.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James E.J. Bottomley <jejb@parisc-linux.org >
Cc: James Hogan <jhogan@kernel.org >
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Ralf Baechle <ralf@linux-mips.org >
Cc: Rich Felker <dalias@libc.org >
Cc: Russell King <linux@armlinux.org.uk >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Will Deacon <will.deacon@arm.com >
Cc: Yoshinori Sato <ysato@users.sourceforge.jp >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:34 -07:00
Alexandre Ghiti
facf6d5b8b
hugetlb: introduce generic version of huge_ptep_set_access_flags()
...
arm, ia64, sh, x86 architectures use the same version
of huge_ptep_set_access_flags, so move this generic implementation
into asm-generic/hugetlb.h.
Link: http://lkml.kernel.org/r/20180920060358.16606-11-alex@ghiti.fr
Signed-off-by: Alexandre Ghiti <alex@ghiti.fr >
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com >
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com >
Tested-by: Helge Deller <deller@gmx.de > [parisc]
Acked-by: Catalin Marinas <catalin.marinas@arm.com > [arm64]
Acked-by: Paul Burton <paul.burton@mips.com > [MIPS]
Acked-by: Ingo Molnar <mingo@kernel.org > [x86]
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: David S. Miller <davem@davemloft.net >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Heiko Carstens <heiko.carstens@de.ibm.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James E.J. Bottomley <jejb@parisc-linux.org >
Cc: James Hogan <jhogan@kernel.org >
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Ralf Baechle <ralf@linux-mips.org >
Cc: Rich Felker <dalias@libc.org >
Cc: Russell King <linux@armlinux.org.uk >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Will Deacon <will.deacon@arm.com >
Cc: Yoshinori Sato <ysato@users.sourceforge.jp >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:34 -07:00
Alexandre Ghiti
8e581d433b
hugetlb: introduce generic version of huge_ptep_set_wrprotect()
...
arm, ia64, mips, powerpc, sh, x86 architectures use the same version of
huge_ptep_set_wrprotect, so move this generic implementation into
asm-generic/hugetlb.h.
Link: http://lkml.kernel.org/r/20180920060358.16606-10-alex@ghiti.fr
Signed-off-by: Alexandre Ghiti <alex@ghiti.fr >
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com >
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com >
Tested-by: Helge Deller <deller@gmx.de > [parisc]
Acked-by: Catalin Marinas <catalin.marinas@arm.com > [arm64]
Acked-by: Paul Burton <paul.burton@mips.com > [MIPS]
Acked-by: Ingo Molnar <mingo@kernel.org > [x86]
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: David S. Miller <davem@davemloft.net >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Heiko Carstens <heiko.carstens@de.ibm.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James E.J. Bottomley <jejb@parisc-linux.org >
Cc: James Hogan <jhogan@kernel.org >
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Ralf Baechle <ralf@linux-mips.org >
Cc: Rich Felker <dalias@libc.org >
Cc: Russell King <linux@armlinux.org.uk >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Will Deacon <will.deacon@arm.com >
Cc: Yoshinori Sato <ysato@users.sourceforge.jp >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:34 -07:00
Alexandre Ghiti
78d6e4e8ea
hugetlb: introduce generic version of prepare_hugepage_range
...
arm, arm64, powerpc, sparc, x86 architectures use the same version of
prepare_hugepage_range, so move this generic implementation into
asm-generic/hugetlb.h.
Link: http://lkml.kernel.org/r/20180920060358.16606-9-alex@ghiti.fr
Signed-off-by: Alexandre Ghiti <alex@ghiti.fr >
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com >
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com >
Tested-by: Helge Deller <deller@gmx.de > [parisc]
Acked-by: Catalin Marinas <catalin.marinas@arm.com > [arm64]
Acked-by: Paul Burton <paul.burton@mips.com > [MIPS]
Acked-by: Ingo Molnar <mingo@kernel.org > [x86]
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: David S. Miller <davem@davemloft.net >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Heiko Carstens <heiko.carstens@de.ibm.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James E.J. Bottomley <jejb@parisc-linux.org >
Cc: James Hogan <jhogan@kernel.org >
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Ralf Baechle <ralf@linux-mips.org >
Cc: Rich Felker <dalias@libc.org >
Cc: Russell King <linux@armlinux.org.uk >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Will Deacon <will.deacon@arm.com >
Cc: Yoshinori Sato <ysato@users.sourceforge.jp >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:34 -07:00
Alexandre Ghiti
c4916a0086
hugetlb: introduce generic version of huge_pte_wrprotect
...
arm, arm64, ia64, mips, parisc, powerpc, sh, sparc, x86 architectures use
the same version of huge_pte_wrprotect, so move this generic
implementation into asm-generic/hugetlb.h.
Link: http://lkml.kernel.org/r/20180920060358.16606-8-alex@ghiti.fr
Signed-off-by: Alexandre Ghiti <alex@ghiti.fr >
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com >
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com >
Tested-by: Helge Deller <deller@gmx.de > [parisc]
Acked-by: Catalin Marinas <catalin.marinas@arm.com > [arm64]
Acked-by: Paul Burton <paul.burton@mips.com > [MIPS]
Acked-by: Ingo Molnar <mingo@kernel.org > [x86]
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: David S. Miller <davem@davemloft.net >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Heiko Carstens <heiko.carstens@de.ibm.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James E.J. Bottomley <jejb@parisc-linux.org >
Cc: James Hogan <jhogan@kernel.org >
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Ralf Baechle <ralf@linux-mips.org >
Cc: Rich Felker <dalias@libc.org >
Cc: Russell King <linux@armlinux.org.uk >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Will Deacon <will.deacon@arm.com >
Cc: Yoshinori Sato <ysato@users.sourceforge.jp >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:34 -07:00
Alexandre Ghiti
cae72abc1a
hugetlb: introduce generic version of huge_pte_none()
...
arm, arm64, ia64, mips, parisc, powerpc, sh, sparc, x86 architectures use
the same version of huge_pte_none, so move this generic implementation
into asm-generic/hugetlb.h.
Link: http://lkml.kernel.org/r/20180920060358.16606-7-alex@ghiti.fr
Signed-off-by: Alexandre Ghiti <alex@ghiti.fr >
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com >
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com >
Tested-by: Helge Deller <deller@gmx.de > [parisc]
Acked-by: Catalin Marinas <catalin.marinas@arm.com > [arm64]
Acked-by: Paul Burton <paul.burton@mips.com > [MIPS]
Acked-by: Ingo Molnar <mingo@kernel.org > [x86]
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: David S. Miller <davem@davemloft.net >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Heiko Carstens <heiko.carstens@de.ibm.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James E.J. Bottomley <jejb@parisc-linux.org >
Cc: James Hogan <jhogan@kernel.org >
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Ralf Baechle <ralf@linux-mips.org >
Cc: Rich Felker <dalias@libc.org >
Cc: Russell King <linux@armlinux.org.uk >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Will Deacon <will.deacon@arm.com >
Cc: Yoshinori Sato <ysato@users.sourceforge.jp >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:34 -07:00
Alexandre Ghiti
fe632225bd
hugetlb: introduce generic version of huge_ptep_clear_flush
...
arm, x86 architectures use the same version of huge_ptep_clear_flush, so
move this generic implementation into asm-generic/hugetlb.h.
Link: http://lkml.kernel.org/r/20180920060358.16606-6-alex@ghiti.fr
Signed-off-by: Alexandre Ghiti <alex@ghiti.fr >
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com >
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com >
Tested-by: Helge Deller <deller@gmx.de > [parisc]
Acked-by: Catalin Marinas <catalin.marinas@arm.com > [arm64]
Acked-by: Paul Burton <paul.burton@mips.com > [MIPS]
Acked-by: Ingo Molnar <mingo@kernel.org > [x86]
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: David S. Miller <davem@davemloft.net >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Heiko Carstens <heiko.carstens@de.ibm.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James E.J. Bottomley <jejb@parisc-linux.org >
Cc: James Hogan <jhogan@kernel.org >
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Ralf Baechle <ralf@linux-mips.org >
Cc: Rich Felker <dalias@libc.org >
Cc: Russell King <linux@armlinux.org.uk >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Will Deacon <will.deacon@arm.com >
Cc: Yoshinori Sato <ysato@users.sourceforge.jp >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:34 -07:00
Alexandre Ghiti
a4d838536c
hugetlb: introduce generic version of huge_ptep_get_and_clear()
...
arm, ia64, sh, x86 architectures use the same version of
huge_ptep_get_and_clear, so move this generic implementation into
asm-generic/hugetlb.h.
Link: http://lkml.kernel.org/r/20180920060358.16606-5-alex@ghiti.fr
Signed-off-by: Alexandre Ghiti <alex@ghiti.fr >
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com >
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com >
Tested-by: Helge Deller <deller@gmx.de > [parisc]
Acked-by: Catalin Marinas <catalin.marinas@arm.com > [arm64]
Acked-by: Paul Burton <paul.burton@mips.com > [MIPS]
Acked-by: Ingo Molnar <mingo@kernel.org > [x86]
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: David S. Miller <davem@davemloft.net >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Heiko Carstens <heiko.carstens@de.ibm.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James E.J. Bottomley <jejb@parisc-linux.org >
Cc: James Hogan <jhogan@kernel.org >
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Ralf Baechle <ralf@linux-mips.org >
Cc: Rich Felker <dalias@libc.org >
Cc: Russell King <linux@armlinux.org.uk >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Will Deacon <will.deacon@arm.com >
Cc: Yoshinori Sato <ysato@users.sourceforge.jp >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:34 -07:00
Alexandre Ghiti
cea685d556
hugetlb: introduce generic version of set_huge_pte_at()
...
arm, ia64, mips, powerpc, sh, x86 architectures use the same version of
set_huge_pte_at, so move this generic implementation into
asm-generic/hugetlb.h.
Link: http://lkml.kernel.org/r/20180920060358.16606-4-alex@ghiti.fr
Signed-off-by: Alexandre Ghiti <alex@ghiti.fr >
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com >
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com >
Tested-by: Helge Deller <deller@gmx.de > [parisc]
Acked-by: Catalin Marinas <catalin.marinas@arm.com > [arm64]
Acked-by: Paul Burton <paul.burton@mips.com > [MIPS]
Acked-by: Ingo Molnar <mingo@kernel.org > [x86]
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: David S. Miller <davem@davemloft.net >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Heiko Carstens <heiko.carstens@de.ibm.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James E.J. Bottomley <jejb@parisc-linux.org >
Cc: James Hogan <jhogan@kernel.org >
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Ralf Baechle <ralf@linux-mips.org >
Cc: Rich Felker <dalias@libc.org >
Cc: Russell King <linux@armlinux.org.uk >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Will Deacon <will.deacon@arm.com >
Cc: Yoshinori Sato <ysato@users.sourceforge.jp >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:34 -07:00
Alexandre Ghiti
1e5f50fc9d
hugetlb: introduce generic version of hugetlb_free_pgd_range
...
arm, arm64, mips, parisc, sh, x86 architectures use the same version of
hugetlb_free_pgd_range, so move this generic implementation into
asm-generic/hugetlb.h.
Link: http://lkml.kernel.org/r/20180920060358.16606-3-alex@ghiti.fr
Signed-off-by: Alexandre Ghiti <alex@ghiti.fr >
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com >
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com >
Tested-by: Helge Deller <deller@gmx.de > [parisc]
Acked-by: Catalin Marinas <catalin.marinas@arm.com > [arm64]
Acked-by: Paul Burton <paul.burton@mips.com > [MIPS]
Acked-by: Ingo Molnar <mingo@kernel.org > [x86]
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: David S. Miller <davem@davemloft.net >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Heiko Carstens <heiko.carstens@de.ibm.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: James E.J. Bottomley <jejb@parisc-linux.org >
Cc: James Hogan <jhogan@kernel.org >
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Ralf Baechle <ralf@linux-mips.org >
Cc: Rich Felker <dalias@libc.org >
Cc: Russell King <linux@armlinux.org.uk >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Will Deacon <will.deacon@arm.com >
Cc: Yoshinori Sato <ysato@users.sourceforge.jp >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:34 -07:00
Alexandre Ghiti
d018498ccc
hugetlb: harmonize hugetlb.h arch specific defines with pgtable.h
...
In order to reduce copy/paste of functions across architectures and then
make riscv hugetlb port (and future ports) simpler and smaller, this
patchset intends to factorize the numerous hugetlb primitives that are
defined across all the architectures.
Except for prepare_hugepage_range, this patchset moves the versions that
are just pass-through to standard pte primitives into
asm-generic/hugetlb.h by using the same #ifdef semantic that can be found
in asm-generic/pgtable.h, i.e. __HAVE_ARCH_***.
s390 architecture has not been tackled in this serie since it does not use
asm-generic/hugetlb.h at all.
This patchset has been compiled on all addressed architectures with
success (except for parisc, but the problem does not come from this
series).
This patch (of 11):
asm-generic/hugetlb.h proposes generic implementations of hugetlb related
functions: use __HAVE_ARCH_HUGE* defines in order to make arch specific
implementations of hugetlb functions consistent with pgtable.h scheme.
Link: http://lkml.kernel.org/r/20180920060358.16606-2-alex@ghiti.fr
Signed-off-by: Alexandre Ghiti <alex@ghiti.fr >
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com >
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com >
Acked-by: Catalin Marinas <catalin.marinas@arm.com > [arm64]
Cc: Russell King <linux@armlinux.org.uk >
Cc: Will Deacon <will.deacon@arm.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Ralf Baechle <ralf@linux-mips.org >
Cc: Paul Burton <paul.burton@mips.com >
Cc: James Hogan <jhogan@kernel.org >
Cc: James E.J. Bottomley <jejb@parisc-linux.org >
Cc: Helge Deller <deller@gmx.de >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Yoshinori Sato <ysato@users.sourceforge.jp >
Cc: Rich Felker <dalias@libc.org >
Cc: David S. Miller <davem@davemloft.net >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com >
Cc: Heiko Carstens <heiko.carstens@de.ibm.com >
Cc: Ingo Molnar <mingo@kernel.org > [x86]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:34 -07:00
Wei Yang
d4faa40259
mm: remove unnecessary local variable addr in __get_user_pages_fast()
...
The local variable `addr' in __get_user_pages_fast() is just a shadow of
`start'. Since `start' never changes after assignment to `addr', it is
fine to replace `start' with it.
Also the meaning of [start, end] is more obvious than [addr, end] when
passed to gup_pgd_range().
Link: http://lkml.kernel.org/r/20180925021448.20265-1-richard.weiyang@gmail.com
Signed-off-by: Wei Yang <richard.weiyang@gmail.com >
Reviewed-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2018-10-26 16:26:34 -07:00