mm/huge_memory: use RMAP_NONE when calling page_add_anon_rmap()

Message ID 20230713120557.218592-1-linmiaohe@huawei.com
State New
Headers
Series mm/huge_memory: use RMAP_NONE when calling page_add_anon_rmap() |

Commit Message

Miaohe Lin July 13, 2023, 12:05 p.m. UTC
  It's more convenient and readable to use RMAP_NONE instead of false when
calling page_add_anon_rmap(). No functional change intended.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/huge_memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Matthew Wilcox July 13, 2023, 12:12 p.m. UTC | #1
On Thu, Jul 13, 2023 at 08:05:57PM +0800, Miaohe Lin wrote:
> It's more convenient and readable to use RMAP_NONE instead of false when
> calling page_add_anon_rmap(). No functional change intended.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
  
Anshuman Khandual July 14, 2023, 3:28 a.m. UTC | #2
On 7/13/23 17:35, Miaohe Lin wrote:
> It's more convenient and readable to use RMAP_NONE instead of false when
> calling page_add_anon_rmap(). No functional change intended.

It's not only more convenient, page_add_anon_rmap() also expects rmap_t
as the last argument.

> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  mm/huge_memory.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 9f3109ed7351..762be2f4244c 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -2255,7 +2255,7 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,
>  				entry = pte_mksoft_dirty(entry);
>  			if (uffd_wp)
>  				entry = pte_mkuffd_wp(entry);
> -			page_add_anon_rmap(page + i, vma, addr, false);
> +			page_add_anon_rmap(page + i, vma, addr, RMAP_NONE);
>  		}
>  		VM_BUG_ON(!pte_none(ptep_get(pte)));
>  		set_pte_at(mm, addr, pte, entry);

After this change, no other page_add_anon_rmap() call site has non rmap_t
argument.

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
  
David Hildenbrand July 14, 2023, 2:24 p.m. UTC | #3
On 13.07.23 14:05, Miaohe Lin wrote:
> It's more convenient and readable to use RMAP_NONE instead of false when
> calling page_add_anon_rmap(). No functional change intended.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>   mm/huge_memory.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 9f3109ed7351..762be2f4244c 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -2255,7 +2255,7 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,
>   				entry = pte_mksoft_dirty(entry);
>   			if (uffd_wp)
>   				entry = pte_mkuffd_wp(entry);
> -			page_add_anon_rmap(page + i, vma, addr, false);
> +			page_add_anon_rmap(page + i, vma, addr, RMAP_NONE);
>   		}
>   		VM_BUG_ON(!pte_none(ptep_get(pte)));
>   		set_pte_at(mm, addr, pte, entry);

Indeed

Reviewed-by: David Hildenbrand <david@redhat.com>
  

Patch

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 9f3109ed7351..762be2f4244c 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2255,7 +2255,7 @@  static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,
 				entry = pte_mksoft_dirty(entry);
 			if (uffd_wp)
 				entry = pte_mkuffd_wp(entry);
-			page_add_anon_rmap(page + i, vma, addr, false);
+			page_add_anon_rmap(page + i, vma, addr, RMAP_NONE);
 		}
 		VM_BUG_ON(!pte_none(ptep_get(pte)));
 		set_pte_at(mm, addr, pte, entry);