Skip to contentSkip to conversation

mm: Change return type to vm_fault_t

PATCH Superseded Souptick Joarder 2 participants 3 messages May 11, 2018

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mm: Change return type to vm_fault_t

Use new return type vm_fault_t for fault handler in struct vm_operations_struct. For now, this is just documenting that the function returns a VM_FAULT value rather than an errno. Once all instances are converted, vm_fault_t will become a distinct type.

commit 1c8f422059ae ("mm: change return type to vm_fault_t")

---
v2: Updated the change log

 mm/hugetlb.c | 2 +-
 mm/mmap.c    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
mm/hugetlb.c +1 -1
index 7c204e3..acb432a 100644
@@ -3158,7 +3158,7 @@ static int hugetlb_vm_op_split(struct vm_area_struct *vma, unsigned long addr)
  * hugegpage VMA.  do_page_fault() is supposed to trap this, so BUG is we get
  * this far.
  */
-static int hugetlb_vm_op_fault(struct vm_fault *vmf)
+static vm_fault_t hugetlb_vm_op_fault(struct vm_fault *vmf)
 {
 	BUG();
 	return 0;
mm/mmap.c +2 -2
index 9efdc021..ac41b34 100644
@@ -3208,7 +3208,7 @@ void vm_stat_account(struct mm_struct *mm, vm_flags_t flags, long npages)
 		mm->data_vm += npages;
 }
 
-static int special_mapping_fault(struct vm_fault *vmf);
+static vm_fault_t special_mapping_fault(struct vm_fault *vmf);
 
 /*
  * Having a close hook prevents vma merging regardless of flags.
@@ -3247,7 +3247,7 @@ static int special_mapping_mremap(struct vm_area_struct *new_vma)
 	.fault = special_mapping_fault,
 };
 
-static int special_mapping_fault(struct vm_fault *vmf)
+static vm_fault_t special_mapping_fault(struct vm_fault *vmf)
 {
 	struct vm_area_struct *vma = vmf->vma;
 	pgoff_t pgoff;
Signature · 1 line
1.9.1
#1 lore raw
Quoted 3 lines · Souptick Joarder
 mm/hugetlb.c | 2 +-
 mm/mmap.c    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Don't we also need to convert include/linux/mm_types.h:

@@ -621,7 +621,7 @@ struct vm_special_mapping {
* If non-NULL, then this is called to resolve page faults
* on the special mapping. If used, .pages is not checked. */
- int (*fault)(const struct vm_special_mapping *sm,
+ vm_fault_t (*fault)(const struct vm_special_mapping *sm,
struct vm_area_struct *vma,
struct vm_fault *vmf);

or are you leaving that for a later patch?

#2 lore raw
Quoted 16 lines · Matthew Wilcox
Quoted 3 lines · Souptick Joarder
 mm/hugetlb.c | 2 +-
 mm/mmap.c    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Don't we also need to convert include/linux/mm_types.h:

(quoted diff) +1 -1
@@ -621,7 +621,7 @@ struct vm_special_mapping {
         * If non-NULL, then this is called to resolve page faults
         * on the special mapping.  If used, .pages is not checked.
         */
-       int (*fault)(const struct vm_special_mapping *sm,
+       vm_fault_t (*fault)(const struct vm_special_mapping *sm,
                     struct vm_area_struct *vma,
                     struct vm_fault *vmf);
 
Quoted 1 line

or are you leaving that for a later patch?

Ahh, I didn't realise. No I think, we can add it as part of this patch. Will send v3.