mm: huge_memory: Change return type to vm_fault_t
Subsystems (2)
PATCH v2 1/1 mm: huge_memory: Change return type to vm_fault_t
Use new return type vm_fault_t for fault handler. 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
include/linux/huge_mm.h | 5 +++-- mm/huge_memory.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-)
include/linux/huge_mm.h +3 -2
@@ -3,6 +3,7 @@#define _LINUX_HUGE_MM_H#include <linux/sched/coredump.h> +#include <linux/mm_types.h> #include <linux/fs.h> /* only for vma_is_dax() */
@@ -46,9 +47,9 @@ extern bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr,extern int change_huge_pmd (struct vm_area_struct *vma,pmd_t *pmd,unsigned long addr,pgprot_t newprot,int prot_numa); -int vmf_insert_pfn_pmd (struct vm_area_struct *vma,unsigned long addr, +vm_fault_t vmf_insert_pfn_pmd (struct vm_area_struct *vma,unsigned long addr,pmd_t *pmd,pfn_t pfn,bool write); -int vmf_insert_pfn_pud (struct vm_area_struct *vma,unsigned long addr, +vm_fault_t vmf_insert_pfn_pud (struct vm_area_struct *vma,unsigned long addr,pud_t *pud,pfn_t pfn,bool write);enum transparent_hugepage_flag {TRANSPARENT_HUGEPAGE_FLAG ,
mm/huge_memory.c +2 -2
@@ -755,7 +755,7 @@ static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr,spin_unlock (ptl); } -int vmf_insert_pfn_pmd (struct vm_area_struct *vma,unsigned long addr, +vm_fault_t vmf_insert_pfn_pmd (struct vm_area_struct *vma,unsigned long addr,pmd_t *pmd,pfn_t pfn,bool write) {pgprot_t pgprot = vma->vm_page_prot;
@@ -815,7 +815,7 @@ static void insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr,spin_unlock (ptl); } -int vmf_insert_pfn_pud (struct vm_area_struct *vma,unsigned long addr, +vm_fault_t vmf_insert_pfn_pud (struct vm_area_struct *vma,unsigned long addr,pud_t *pud,pfn_t pfn,bool write) {pgprot_t pgprot = vma->vm_page_prot;
Signature · 1 line
1.9.1
Quoted 54 lines · Souptick Joarder
Use new return type
vm_fault_tfor fault handler. For now, this is just documenting that the function returns aVM_FAULTvalue rather than an errno. Once all instances are converted,vm_fault_twill become a distinct type.Commit
1c8f422059ae("mm: change return type tovm_fault_t")Signed-off-by Souptick Joarder <[email protected]>Reviewed-by Matthew Wilcox <[email protected]>---
v2: Updated the change loginclude/linux/huge_mm.h | 5 +++-- mm/huge_memory.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-)include/linux/huge_mm.h +3
-2@@ -3,6 +3,7 @@#define _LINUX_HUGE_MM_H#include <linux/sched/coredump.h> +#include <linux/mm_types.h> #include <linux/fs.h> /* only for vma_is_dax() */ @@ -46,9 +47,9 @@ extern bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr,extern int change_huge_pmd (struct vm_area_struct *vma,pmd_t *pmd,unsigned long addr,pgprot_t newprot,int prot_numa); -int vmf_insert_pfn_pmd (struct vm_area_struct *vma,unsigned long addr, +vm_fault_t vmf_insert_pfn_pmd (struct vm_area_struct *vma,unsigned long addr,pmd_t *pmd,pfn_t pfn,bool write); -int vmf_insert_pfn_pud (struct vm_area_struct *vma,unsigned long addr, +vm_fault_t vmf_insert_pfn_pud (struct vm_area_struct *vma,unsigned long addr,pud_t *pud,pfn_t pfn,bool write);enum transparent_hugepage_flag {TRANSPARENT_HUGEPAGE_FLAG ,mm/huge_memory.c +1
-1@@ -755,7 +755,7 @@ static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr,spin_unlock (ptl); } -int vmf_insert_pfn_pmd (struct vm_area_struct *vma,unsigned long addr, +vm_fault_t vmf_insert_pfn_pmd (struct vm_area_struct *vma,unsigned long addr,pmd_t *pmd,pfn_t pfn,bool write) {pgprot_t pgprot = vma->vm_page_prot;
mm/huge_memory.c static void insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr, · line 821
Quoted 8 lines
mm/huge_memory.c +1
-1@@ -815,7 +815,7 @@ static void insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr,spin_unlock (ptl); } -int vmf_insert_pfn_pud (struct vm_area_struct *vma,unsigned long addr, +vm_fault_t vmf_insert_pfn_pud (struct vm_area_struct *vma,unsigned long addr,pud_t *pud,pfn_t pfn,bool write) {pgprot_t pgprot = vma->vm_page_prot;
This isn't very useful unless functions that return the return value of these functions, __dev_dax_{pmd,pud}_fault(), recast it as an int. __dev_dax_pte_fault() would do the same thing, so it should logically also be vm_fault_t, so then you would convert dev_dax_huge_fault() and dev_dax_fault() as well in the same patch.
Quoted 59 lines · David Rientjes
Quoted 57 lines · Souptick Joarder
Use new return type
vm_fault_tfor fault handler. For now, this is just documenting that the function returns aVM_FAULTvalue rather than an errno. Once all instances are converted,vm_fault_twill become a distinct type.Commit
1c8f422059ae("mm: change return type tovm_fault_t")Signed-off-by Souptick Joarder <[email protected]>Reviewed-by Matthew Wilcox <[email protected]>---
v2: Updated the change loginclude/linux/huge_mm.h | 5 +++-- mm/huge_memory.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-)include/linux/huge_mm.h +3
-2@@ -3,6 +3,7 @@#define _LINUX_HUGE_MM_H#include <linux/sched/coredump.h> +#include <linux/mm_types.h> #include <linux/fs.h> /* only for vma_is_dax() */ @@ -46,9 +47,9 @@ extern bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr,extern int change_huge_pmd (struct vm_area_struct *vma,pmd_t *pmd,unsigned long addr,pgprot_t newprot,int prot_numa); -int vmf_insert_pfn_pmd (struct vm_area_struct *vma,unsigned long addr, +vm_fault_t vmf_insert_pfn_pmd (struct vm_area_struct *vma,unsigned long addr,pmd_t *pmd,pfn_t pfn,bool write); -int vmf_insert_pfn_pud (struct vm_area_struct *vma,unsigned long addr, +vm_fault_t vmf_insert_pfn_pud (struct vm_area_struct *vma,unsigned long addr,pud_t *pud,pfn_t pfn,bool write);enum transparent_hugepage_flag {TRANSPARENT_HUGEPAGE_FLAG ,mm/huge_memory.c +1
-1@@ -755,7 +755,7 @@ static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr,spin_unlock (ptl); } -int vmf_insert_pfn_pmd (struct vm_area_struct *vma,unsigned long addr, +vm_fault_t vmf_insert_pfn_pmd (struct vm_area_struct *vma,unsigned long addr,pmd_t *pmd,pfn_t pfn,bool write) {pgprot_t pgprot = vma->vm_page_prot;@@ -815,7 +815,7 @@ static void insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr,spin_unlock (ptl); }
Quoted 11 lines
mm/huge_memory.c static void insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr, · line 821
Quoted 5 lines
mm/huge_memory.c +1
-1-int vmf_insert_pfn_pud (struct vm_area_struct *vma,unsigned long addr, +vm_fault_t vmf_insert_pfn_pud (struct vm_area_struct *vma,unsigned long addr,pud_t *pud,pfn_t pfn,bool write) {pgprot_t pgprot = vma->vm_page_prot;This isn't very useful unless functions that return the return value of these functions, __dev_dax_{pmd,pud}_fault(), recast it as an int.
__dev_dax_pte_fault()would do the same thing, so it should logically also bevm_fault_t, so then you would convertdev_dax_huge_fault()anddev_dax_fault()as well in the same patch.
yes, the return value of _dev_dax_{pmd,pud,pte}_fault(), dev_dax_huge_fault(), dev_dax_fault() is already changed in a separate patch which was reviewed by Matthew and Ross. Other patch was posted in linux-nvdimm mailing list.