[PATCH 3/5] mm,hugetlb: Conver anon_rmap into boolean

Oscar Salvador posted 5 patches 4 months ago
[PATCH 3/5] mm,hugetlb: Conver anon_rmap into boolean
Posted by Oscar Salvador 4 months ago
We use anon_rmap as a boolean, so declare it as that.

Signed-off-by: Oscar Salvador <osalvador@suse.de>
---
 mm/hugetlb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index dfa09fc3b2c6..62bc3808f99e 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -6431,7 +6431,7 @@ static vm_fault_t hugetlb_no_page(struct address_space *mapping,
 	struct mm_struct *mm = vma->vm_mm;
 	struct hstate *h = hstate_vma(vma);
 	vm_fault_t ret = VM_FAULT_SIGBUS;
-	int anon_rmap = 0;
+	bool anon_rmap = false;
 	unsigned long size;
 	struct folio *folio;
 	pte_t new_pte;
@@ -6542,7 +6542,7 @@ static vm_fault_t hugetlb_no_page(struct address_space *mapping,
 			 * check whether we can re-use this page exclusively for us.
 			 */
 			folio_lock(folio);
-			anon_rmap = 1;
+			anon_rmap = true;
 		}
 	} else {
 		/*
-- 
2.49.0
Re: [PATCH 3/5] mm,hugetlb: Conver anon_rmap into boolean
Posted by David Hildenbrand 3 months, 4 weeks ago
On 12.06.25 15:46, Oscar Salvador wrote:
> We use anon_rmap as a boolean, so declare it as that.
> 
> Signed-off-by: Oscar Salvador <osalvador@suse.de>
> ---
>   mm/hugetlb.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index dfa09fc3b2c6..62bc3808f99e 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -6431,7 +6431,7 @@ static vm_fault_t hugetlb_no_page(struct address_space *mapping,
>   	struct mm_struct *mm = vma->vm_mm;
>   	struct hstate *h = hstate_vma(vma);
>   	vm_fault_t ret = VM_FAULT_SIGBUS;
> -	int anon_rmap = 0;
> +	bool anon_rmap = false;
>   	unsigned long size;
>   	struct folio *folio;
>   	pte_t new_pte;
> @@ -6542,7 +6542,7 @@ static vm_fault_t hugetlb_no_page(struct address_space *mapping,
>   			 * check whether we can re-use this page exclusively for us.
>   			 */
>   			folio_lock(folio);
> -			anon_rmap = 1;
> +			anon_rmap = true;
>   		}
>   	} else {
>   		/*

While at it, I would rename that to "new_anon_folio" or sth like that.

It's used to distinguish whether we create an anon or a file folio.

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

-- 
Cheers,

David / dhildenb