mm-join-struct-fault_env-and-vm_fault.patch removed from -mm tree
The patch titled
Subject: mm: join struct fault_env and vm_fault
has been removed from the -mm tree. Its filename was
mm-join-struct-fault_env-and-vm_fault.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Jan Kara <[email protected]>
Subject: mm: join struct fault_env and vm_fault
Currently we have two different structures for passing fault information around - struct vm_fault and struct fault_env. DAX will need more information in struct vm_fault to handle its faults so the content of that structure would become event closer to fault_env. Furthermore it would need to generate struct fault_env to be able to call some of the generic functions. So at this point I don't think there's much use in keeping these two structures separate. Just embed into struct vm_fault all that is needed to use it for both purposes.
---
Documentation/filesystems/Locking | 2 fs/userfaultfd.c | 22 - include/linux/huge_mm.h | 10 include/linux/mm.h | 28 - include/linux/userfaultfd_k.h | 4 mm/filemap.c | 14 mm/huge_memory.c | 173 ++++---- mm/internal.h | 2 mm/khugepaged.c | 20 mm/memory.c | 568 ++++++++++++++-------------- mm/nommu.c | 2 11 files changed, 423 insertions(+), 422 deletions(-)
Documentation/filesystems/Locking renamed from Documentation/filesystems/Locking~mm-join-struct-fault_env-and-vm_fault +1 -1
@@ -556,7 +556,7 @@ till "end_pgoff". ->map_pages() is calle not block. If it's not possible to reach a page without blocking, filesystem should skip it. Filesystem should use do_set_pte() to setup page table entry. Pointer to entry associated with the page is passed in -"pte" field in fault_env structure. Pointers to entries for other offsets +"pte" field in vm_fault structure. Pointers to entries for other offsets should be calculated relative to "pte". ->page_mkwrite() is called when a previously read-only pte is
fs/userfaultfd.c renamed from fs/userfaultfd.c~mm-join-struct-fault_env-and-vm_fault +12 -10
@@ -257,9 +257,9 @@ out:* fatal_signal_pending()s, and the mmap_sem must be released before * returning it. */ -int handle_userfault (struct fault_env *fe,unsigned long reason) +int handle_userfault (struct vm_fault *vmf,unsigned long reason) { -struct mm_struct *mm = fe->vma->vm_mm; +struct mm_struct *mm = vmf->vma->vm_mm;struct userfaultfd_ctx *ctx;struct userfaultfd_wait_queue uwq;int ret;
@@ -268,7 +268,7 @@ int handle_userfault(struct fault_env *fBUG_ON (!rwsem_is_locked (&mm->mmap_sem)); ret =VM_FAULT_SIGBUS ; - ctx = fe->vma->vm_userfaultfd_ctx.ctx; + ctx = vmf->vma->vm_userfaultfd_ctx.ctx;if (!ctx) goto out;
@@ -301,17 +301,18 @@ int handle_userfault(struct fault_env *f* without first stopping userland access to the memory. For * VM_UFFD_MISSING userfaults this is enough for now. */ -if (unlikely (!(fe->flags &FAULT_FLAG_ALLOW_RETRY ))) { +if (unlikely (!(vmf->flags &FAULT_FLAG_ALLOW_RETRY ))) {/* * Validate the invariant that nowait must allow retry * to be sure not to return SIGBUS erroneously on * nowait invocations. */ -BUG_ON (fe->flags &FAULT_FLAG_RETRY_NOWAIT ); +BUG_ON (vmf->flags &FAULT_FLAG_RETRY_NOWAIT );#ifdef CONFIG_DEBUG_VM if (printk_ratelimit ()) {printk (KERN_WARNING -"FAULT_FLAG_ALLOW_RETRY missing %x\n" , fe->flags); +"FAULT_FLAG_ALLOW_RETRY missing %x\n" , + vmf->flags);dump_stack (); }#endif
@@ -323,7 +324,7 @@ int handle_userfault(struct fault_env *f* and wait. */ ret =VM_FAULT_RETRY ; -if (fe->flags &FAULT_FLAG_RETRY_NOWAIT ) +if (vmf->flags &FAULT_FLAG_RETRY_NOWAIT ) goto out;/* take the reference before dropping the mmap_sem */
@@ -331,11 +332,11 @@ int handle_userfault(struct fault_env *finit_waitqueue_func_entry (&uwq.wq, userfaultfd_wake_function); uwq.wq.private = current; - uwq.msg =userfault_msg (fe->address, fe->flags, reason); + uwq.msg =userfault_msg (vmf->address, vmf->flags, reason); uwq.ctx = ctx; return_to_userland = - (fe->flags & (FAULT_FLAG_USER |FAULT_FLAG_KILLABLE )) == + (vmf->flags & (FAULT_FLAG_USER |FAULT_FLAG_KILLABLE )) == (FAULT_FLAG_USER |FAULT_FLAG_KILLABLE );spin_lock (&ctx->fault_pending_wqh.lock);
@@ -353,7 +354,8 @@ int handle_userfault(struct fault_env *f TASK_KILLABLE);spin_unlock (&ctx->fault_pending_wqh.lock); - must_wait =userfaultfd_must_wait (ctx, fe->address, fe->flags, reason); + must_wait =userfaultfd_must_wait (ctx, vmf->address, vmf->flags, + reason);up_read (&mm->mmap_sem); if (likely(must_wait && !ACCESS_ONCE(ctx->released) &&
include/linux/huge_mm.h renamed from include/linux/huge_mm.h~mm-join-struct-fault_env-and-vm_fault +5 -5
@@ -1,12 +1,12 @@#ifndef _LINUX_HUGE_MM_H#define _LINUX_HUGE_MM_H -extern int do_huge_pmd_anonymous_page (struct fault_env *fe); +extern int do_huge_pmd_anonymous_page (struct vm_fault *vmf);extern int copy_huge_pmd (struct mm_struct *dst_mm,struct mm_struct *src_mm,pmd_t *dst_pmd,pmd_t *src_pmd,unsigned long addr,struct vm_area_struct *vma); -extern void huge_pmd_set_accessed (struct fault_env *fe,pmd_t orig_pmd); -extern int do_huge_pmd_wp_page (struct fault_env *fe,pmd_t orig_pmd); +extern void huge_pmd_set_accessed (struct vm_fault *vmf,pmd_t orig_pmd); +extern int do_huge_pmd_wp_page (struct vm_fault *vmf,pmd_t orig_pmd); extern struct page *follow_trans_huge_pmd(struct vm_area_struct *vma, unsigned long addr, pmd_t *pmd,
@@ -142,7 +142,7 @@ static inline int hpage_nr_pages(structreturn 1 ; } -extern int do_huge_pmd_numa_page (struct fault_env *fe,pmd_t orig_pmd); +extern int do_huge_pmd_numa_page (struct vm_fault *vmf,pmd_t orig_pmd);extern struct page *huge_zero_page;
@@ -212,7 +212,7 @@ static inline spinlock_t *pmd_trans_hugereturn NULL ; } -static inline int do_huge_pmd_numa_page (struct fault_env *fe,pmd_t orig_pmd) +static inline int do_huge_pmd_numa_page (struct vm_fault *vmf,pmd_t orig_pmd) {return 0 ; }
include/linux/mm.h renamed from include/linux/mm.h~mm-join-struct-fault_env-and-vm_fault +11 -17
@@ -292,10 +292,16 @@ extern pgprot_t protection_map[16];* pgoff should be used in favour of virtual_address, if possible. */ struct vm_fault { +struct vm_area_struct *vma;/* Target VMA */ unsigned int flags;/* FAULT_FLAG_xxx flags */ gfp_t gfp_mask;/* gfp mask to be used for allocations */ pgoff_t pgoff;/* Logical page offset based on vma */ -void __user *virtual_address;/* Faulting virtual address */ +unsigned long address;/* Faulting virtual address */ +void __user *virtual_address;/* Faulting virtual address masked by +* PAGE_MASK */ +pmd_t *pmd;/* Pointer to pmd entry matching +* the 'address' +*/ struct page *cow_page;/* Handler may choose to COW */ struct page *page;/* ->fault handlers should return a
@@ -309,19 +315,7 @@ struct vm_fault {* VM_FAULT_DAX_LOCKED and fill in * entry here. */ -}; - -/* -* Page fault context: passes though page fault handler instead of endless list -* of function arguments. -*/ -struct fault_env { -struct vm_area_struct *vma;/* Target VMA */ -unsigned long address;/* Faulting virtual address */ -unsigned int flags;/* FAULT_FLAG_xxx flags */ -pmd_t *pmd;/* Pointer to pmd entry matching -* the 'address' -*/ +/* These three entries are valid only while holding ptl lock */ pte_t *pte;/* Pointer to pte entry matching * the 'address'. NULL if the page * table hasn't been allocated.
@@ -351,7 +345,7 @@ struct vm_operations_struct {int (*fault)(struct vm_area_struct *vma,struct vm_fault *vmf);int (*pmd_fault)(struct vm_area_struct *,unsigned long address,pmd_t *,unsigned int flags); -void (*map_pages)(struct fault_env *fe, +void (*map_pages)(struct vm_fault *vmf,pgoff_t start_pgoff,pgoff_t end_pgoff);/* notification that a previously read-only page is about to become
@@ -625,7 +619,7 @@ static inline pte_t maybe_mkwrite(pte_t return pte; } -int alloc_set_pte (struct fault_env *fe,struct mem_cgroup *memcg, +int alloc_set_pte (struct vm_fault *vmf,struct mem_cgroup *memcg,struct page *page);#endif
@@ -2094,7 +2088,7 @@ extern void truncate_inode_pages_final(s/* generic vm_area_ops exported for stackable file systems */ extern int filemap_fault (struct vm_area_struct *,struct vm_fault *); -extern void filemap_map_pages (struct fault_env *fe, +extern void filemap_map_pages (struct vm_fault *vmf,pgoff_t start_pgoff,pgoff_t end_pgoff);extern int filemap_page_mkwrite (struct vm_area_struct *vma,struct vm_fault *vmf);
include/linux/userfaultfd_k.h renamed from include/linux/userfaultfd_k.h~mm-join-struct-fault_env-and-vm_fault +2 -2
@@ -27,7 +27,7 @@#define UFFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK)#define UFFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS) -extern int handle_userfault (struct fault_env *fe,unsigned long reason); +extern int handle_userfault (struct vm_fault *vmf,unsigned long reason);extern ssize_t mcopy_atomic (struct mm_struct *dst_mm,unsigned long dst_start,unsigned long src_start,unsigned long len);
@@ -55,7 +55,7 @@ static inline bool userfaultfd_armed(str#else /* CONFIG_USERFAULTFD */ /* mm helpers */ -static inline int handle_userfault (struct fault_env *fe,unsigned long reason) +static inline int handle_userfault (struct vm_fault *vmf,unsigned long reason) {return VM_FAULT_SIGBUS ; }
mm/filemap.c renamed from mm/filemap.c~mm-join-struct-fault_env-and-vm_fault +7 -7
@@ -2164,12 +2164,12 @@ page_not_uptodate: }EXPORT_SYMBOL (filemap_fault); -void filemap_map_pages (struct fault_env *fe, +void filemap_map_pages (struct vm_fault *vmf,pgoff_t start_pgoff,pgoff_t end_pgoff) {struct radix_tree_iter iter;void **slot; -struct file *file = fe->vma->vm_file; +struct file *file = vmf->vma->vm_file;struct address_space *mapping = file->f_mapping;pgoff_t last_pgoff = start_pgoff;loff_t size;
@@ -2225,11 +2225,11 @@ repeat:if (file->f_ra.mmap_miss >0 ) file->f_ra.mmap_miss--; - fe->address += (iter.index - last_pgoff) <<PAGE_SHIFT ; -if (fe->pte) - fe->pte += iter.index - last_pgoff; + vmf->address += (iter.index - last_pgoff) <<PAGE_SHIFT ; +if (vmf->pte) + vmf->pte += iter.index - last_pgoff; last_pgoff = iter.index; -if (alloc_set_pte (fe,NULL , page)) +if (alloc_set_pte (vmf,NULL , page)) goto unlock;unlock_page (page); goto next;
@@ -2239,7 +2239,7 @@ skip:put_page (page); next:/* Huge page is mapped? No need to proceed. */ -if (pmd_trans_huge (*fe->pmd)) +if (pmd_trans_huge (*vmf->pmd))break ;if (iter.index == end_pgoff)break ;
mm/huge_memory.c renamed from mm/huge_memory.c~mm-join-struct-fault_env-and-vm_fault +87 -86
424 lines not on this page · raw message
mm/internal.h renamed from mm/internal.h~mm-join-struct-fault_env-and-vm_fault +1 -1
@@ -36,7 +36,7 @@/* Do not use these with a slab allocator */ #define GFP_SLAB_BUG_MASK (__GFP_DMA32|__GFP_HIGHMEM|~__GFP_BITS_MASK) -int do_swap_page (struct fault_env *fe,pte_t orig_pte); +int do_swap_page (struct vm_fault *vmf,pte_t orig_pte);void free_pgtables (struct mmu_gather *tlb,struct vm_area_struct *start_vma,unsigned long floor,unsigned long ceiling);
mm/khugepaged.c renamed from mm/khugepaged.c~mm-join-struct-fault_env-and-vm_fault +10 -10
@@ -877,7 +877,7 @@ static bool __collapse_huge_page_swapin( {pte_t pteval;int swapped_in =0 , ret =0 ; -struct fault_env fe = { +struct vm_fault vmf = { .vma = vma, .address = address, .flags =FAULT_FLAG_ALLOW_RETRY ,
@@ -889,19 +889,19 @@ static bool __collapse_huge_page_swapin(trace_mm_collapse_huge_page_swapin (mm, swapped_in, referenced,0 );return false; } - fe.pte =pte_offset_map (pmd, address); -for (; fe.address < address +HPAGE_PMD_NR *PAGE_SIZE ; - fe.pte++, fe.address +=PAGE_SIZE ) { - pteval = *fe.pte; + vmf.pte =pte_offset_map (pmd, address); +for (; vmf.address < address +HPAGE_PMD_NR *PAGE_SIZE ; + vmf.pte++, vmf.address +=PAGE_SIZE ) { + pteval = *vmf.pte;if (!is_swap_pte (pteval))continue ; swapped_in++; - ret =do_swap_page (&fe, pteval); + ret =do_swap_page (&vmf, pteval);/* do_swap_page returns VM_FAULT_RETRY with released mmap_sem */ if (ret &VM_FAULT_RETRY ) {down_read (&mm->mmap_sem); -if (hugepage_vma_revalidate (mm, address, &fe.vma)) { +if (hugepage_vma_revalidate (mm, address, &vmf.vma)) {/* vma is no longer available, don't continue to swapin */ trace_mm_collapse_huge_page_swapin (mm, swapped_in, referenced,0 );return false;
@@ -915,10 +915,10 @@ static bool __collapse_huge_page_swapin(return false; }/* pte is unmapped now, we need to map it */ - fe.pte =pte_offset_map (pmd, fe.address); + vmf.pte =pte_offset_map (pmd, vmf.address); } - fe.pte--; -pte_unmap (fe.pte); + vmf.pte--; +pte_unmap (vmf.pte);trace_mm_collapse_huge_page_swapin (mm, swapped_in, referenced,1 );return true; }
mm/memory.c renamed from mm/memory.c~mm-join-struct-fault_env-and-vm_fault +286 -282
1,247 lines not on this page · raw message
mm/nommu.c renamed from mm/nommu.c~mm-join-struct-fault_env-and-vm_fault +1 -1
@@ -1801,7 +1801,7 @@ int filemap_fault(struct vm_area_struct }EXPORT_SYMBOL (filemap_fault); -void filemap_map_pages (struct fault_env *fe, +void filemap_map_pages (struct vm_fault *vmf,pgoff_t start_pgoff,pgoff_t end_pgoff) {BUG ();
_
Patches currently in -mm which might be from [email protected] are