Commit 38bc9c28 authored by Hao Ge's avatar Hao Ge Committed by Andrew Morton

mm/mmap: make vma_wants_writenotify return bool

vma_wants_writenotify() should return bool, so change it.

Link: https://lkml.kernel.org/r/20240407062653.803142-1-gehao@kylinos.cnSigned-off-by: default avatarHao Ge <gehao@kylinos.cn>
Cc: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Lorenzo Stoakes <lstoakes@gmail.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent cf93be18
...@@ -2575,7 +2575,7 @@ extern unsigned long move_page_tables(struct vm_area_struct *vma, ...@@ -2575,7 +2575,7 @@ extern unsigned long move_page_tables(struct vm_area_struct *vma,
MM_CP_UFFD_WP_RESOLVE) MM_CP_UFFD_WP_RESOLVE)
bool vma_needs_dirty_tracking(struct vm_area_struct *vma); bool vma_needs_dirty_tracking(struct vm_area_struct *vma);
int vma_wants_writenotify(struct vm_area_struct *vma, pgprot_t vm_page_prot); bool vma_wants_writenotify(struct vm_area_struct *vma, pgprot_t vm_page_prot);
static inline bool vma_wants_manual_pte_write_upgrade(struct vm_area_struct *vma) static inline bool vma_wants_manual_pte_write_upgrade(struct vm_area_struct *vma)
{ {
/* /*
......
...@@ -1514,32 +1514,32 @@ bool vma_needs_dirty_tracking(struct vm_area_struct *vma) ...@@ -1514,32 +1514,32 @@ bool vma_needs_dirty_tracking(struct vm_area_struct *vma)
* to the private version (using protection_map[] without the * to the private version (using protection_map[] without the
* VM_SHARED bit). * VM_SHARED bit).
*/ */
int vma_wants_writenotify(struct vm_area_struct *vma, pgprot_t vm_page_prot) bool vma_wants_writenotify(struct vm_area_struct *vma, pgprot_t vm_page_prot)
{ {
/* If it was private or non-writable, the write bit is already clear */ /* If it was private or non-writable, the write bit is already clear */
if (!vma_is_shared_writable(vma)) if (!vma_is_shared_writable(vma))
return 0; return false;
/* The backer wishes to know when pages are first written to? */ /* The backer wishes to know when pages are first written to? */
if (vm_ops_needs_writenotify(vma->vm_ops)) if (vm_ops_needs_writenotify(vma->vm_ops))
return 1; return true;
/* The open routine did something to the protections that pgprot_modify /* The open routine did something to the protections that pgprot_modify
* won't preserve? */ * won't preserve? */
if (pgprot_val(vm_page_prot) != if (pgprot_val(vm_page_prot) !=
pgprot_val(vm_pgprot_modify(vm_page_prot, vma->vm_flags))) pgprot_val(vm_pgprot_modify(vm_page_prot, vma->vm_flags)))
return 0; return false;
/* /*
* Do we need to track softdirty? hugetlb does not support softdirty * Do we need to track softdirty? hugetlb does not support softdirty
* tracking yet. * tracking yet.
*/ */
if (vma_soft_dirty_enabled(vma) && !is_vm_hugetlb_page(vma)) if (vma_soft_dirty_enabled(vma) && !is_vm_hugetlb_page(vma))
return 1; return true;
/* Do we need write faults for uffd-wp tracking? */ /* Do we need write faults for uffd-wp tracking? */
if (userfaultfd_wp(vma)) if (userfaultfd_wp(vma))
return 1; return true;
/* Can the mapping track the dirty pages? */ /* Can the mapping track the dirty pages? */
return vma_fs_can_writeback(vma); return vma_fs_can_writeback(vma);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment