Skip to contentSkip to conversation

mm/hugetlb: Remove unnecessary huge_ptep_set_access_flags() in hugetlb_mcopy_atomic_pte()

PATCH Superseded Baolin Wang 4 participants 5 messages May 25, 2022 – May 27, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/hugetlb: Remove unnecessary huge_ptep_set_access_flags() in hugetlb_mcopy_atomic_pte()

There is no need to update the hugetlb access flags after just setting the hugetlb page table entry by set_huge_pte_at(), since the page table entry value has no changes. Thus remove the unnecessary huge_ptep_set_access_flags() in hugetlb_mcopy_atomic_pte().

---
 mm/hugetlb.c | 2 --
 1 file changed, 2 deletions(-)
mm/hugetlb.c +0 -2
index 7c468ac..3ad49bf 100644
@@ -6032,8 +6032,6 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
 
 	set_huge_pte_at(dst_mm, dst_addr, dst_pte, _dst_pte);
 
-	(void)huge_ptep_set_access_flags(dst_vma, dst_addr, dst_pte, _dst_pte,
-					dst_vma->vm_flags & VM_WRITE);
 	hugetlb_count_add(pages_per_huge_page(h), dst_mm);
 
 	/* No need to invalidate - it was non-present before */
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Baolin Wang

There is no need to update the hugetlb access flags after just setting the hugetlb page table entry by set_huge_pte_at(), since the page table entry value has no changes. Thus remove the unnecessary huge_ptep_set_access_flags() in hugetlb_mcopy_atomic_pte().

Thanks.

Reviewed-by on v1 1/1
#2 lore raw
In reply to Baolin Wang
Quoted 9 lines · Baolin Wang

There is no need to update the hugetlb access flags after just setting the hugetlb page table entry by set_huge_pte_at(), since the page table entry value has no changes. Thus remove the unnecessary huge_ptep_set_access_flags() in hugetlb_mcopy_atomic_pte().

---
 mm/hugetlb.c | 2 --
 1 file changed, 2 deletions(-)

Thanks! I agree that does nothing and should be removed.

Quoted 14 lines
mm/hugetlb.c +0 -2
index 7c468ac..3ad49bf 100644
@@ -6032,8 +6032,6 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
 
 	set_huge_pte_at(dst_mm, dst_addr, dst_pte, _dst_pte);
 
-	(void)huge_ptep_set_access_flags(dst_vma, dst_addr, dst_pte, _dst_pte,
-					dst_vma->vm_flags & VM_WRITE);
 	hugetlb_count_add(pages_per_huge_page(h), dst_mm);
 
 	/* No need to invalidate - it was non-present before */
Signature · 1 line
Mike Kravetz
Reviewed-by on v1 1/1
#3 lore raw
In reply to Baolin Wang
Quoted 3 lines · Baolin Wang

There is no need to update the hugetlb access flags after just setting the hugetlb page table entry by set_huge_pte_at(), since the page table entry value has no changes. Thus remove the unnecessary huge_ptep_set_access_flags()

WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line) #9:
value has no changes. Thus remove the unnecessary huge_ptep_set_access_flags()

total: 0 errors, 1 warnings, 8 lines checked

Quoted 3 lines

in hugetlb_mcopy_atomic_pte().

Otherwise LGTM,

Quoted 17 lines
---
 mm/hugetlb.c | 2 --
 1 file changed, 2 deletions(-)
mm/hugetlb.c +0 -2
index 7c468ac..3ad49bf 100644
@@ -6032,8 +6032,6 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
 
 	set_huge_pte_at(dst_mm, dst_addr, dst_pte, _dst_pte);
 
-	(void)huge_ptep_set_access_flags(dst_vma, dst_addr, dst_pte, _dst_pte,
-					dst_vma->vm_flags & VM_WRITE);
 	hugetlb_count_add(pages_per_huge_page(h), dst_mm);
 
 	/* No need to invalidate - it was non-present before */
#4 lore raw
Quoted 7 lines · Anshuman Khandual
Quoted 3 lines · Baolin Wang

There is no need to update the hugetlb access flags after just setting the hugetlb page table entry by set_huge_pte_at(), since the page table entry value has no changes. Thus remove the unnecessary huge_ptep_set_access_flags()

Quoted 5 lines

WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line) #9:
value has no changes. Thus remove the unnecessary huge_ptep_set_access_flags()

total: 0 errors, 1 warnings, 8 lines checked

Sure, will remove checkpatch warning in next verion.

Quoted 8 lines
Quoted 4 lines

in hugetlb_mcopy_atomic_pte().

Otherwise LGTM,

Thanks. Also thanks to Muchun and Mike for reviewing.