All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mm: huge_memory: Change return type to vm_fault_t
@ 2018-04-25  4:43 Souptick Joarder
  2018-04-25  7:09 ` David Rientjes
  0 siblings, 1 reply; 3+ messages in thread
From: Souptick Joarder @ 2018-04-25  4:43 UTC (permalink / raw)
  To: akpm, zi.yan, dan.j.williams, kirill.shutemov, ross.zwisler,
	n-horiguchi, mhocko, shli
  Cc: linux-kernel, linux-mm

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")

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
---
v2: Updated the change log

 include/linux/huge_mm.h | 5 +++--
 mm/huge_memory.c        | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index a8a1262..d3bbf6b 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -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,
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 87ab9b8..1fe4705 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -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;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mm: huge_memory: Change return type to vm_fault_t
  2018-04-25  4:43 [PATCH v2] mm: huge_memory: Change return type to vm_fault_t Souptick Joarder
@ 2018-04-25  7:09 ` David Rientjes
  2018-04-27  5:49   ` Souptick Joarder
  0 siblings, 1 reply; 3+ messages in thread
From: David Rientjes @ 2018-04-25  7:09 UTC (permalink / raw)
  To: Souptick Joarder
  Cc: akpm, zi.yan, dan.j.williams, kirill.shutemov, ross.zwisler,
	n-horiguchi, mhocko, shli, linux-kernel, linux-mm

On Wed, 25 Apr 2018, Souptick Joarder wrote:

> 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")
> 
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
> ---
> v2: Updated the change log
> 
>  include/linux/huge_mm.h | 5 +++--
>  mm/huge_memory.c        | 4 ++--
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
> index a8a1262..d3bbf6b 100644
> --- a/include/linux/huge_mm.h
> +++ b/include/linux/huge_mm.h
> @@ -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,
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 87ab9b8..1fe4705 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -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;

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mm: huge_memory: Change return type to vm_fault_t
  2018-04-25  7:09 ` David Rientjes
@ 2018-04-27  5:49   ` Souptick Joarder
  0 siblings, 0 replies; 3+ messages in thread
From: Souptick Joarder @ 2018-04-27  5:49 UTC (permalink / raw)
  To: David Rientjes, Matthew Wilcox
  Cc: Andrew Morton, zi.yan, Dan Williams, kirill.shutemov,
	Ross Zwisler, n-horiguchi, Michal Hocko, shli, linux-kernel,
	Linux-MM

On Wed, Apr 25, 2018 at 12:39 PM, David Rientjes <rientjes@google.com> wrote:
> On Wed, 25 Apr 2018, Souptick Joarder wrote:
>
>> 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")
>>
>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>> Reviewed-by: Matthew Wilcox <mawilcox@microsoft.com>
>> ---
>> v2: Updated the change log
>>
>>  include/linux/huge_mm.h | 5 +++--
>>  mm/huge_memory.c        | 4 ++--
>>  2 files changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
>> index a8a1262..d3bbf6b 100644
>> --- a/include/linux/huge_mm.h
>> +++ b/include/linux/huge_mm.h
>> @@ -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,
>> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
>> index 87ab9b8..1fe4705 100644
>> --- a/mm/huge_memory.c
>> +++ b/mm/huge_memory.c
>> @@ -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;
>
> 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.

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-27  5:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-25  4:43 [PATCH v2] mm: huge_memory: Change return type to vm_fault_t Souptick Joarder
2018-04-25  7:09 ` David Rientjes
2018-04-27  5:49   ` Souptick Joarder

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.