Skip to contentSkip to conversation

mm: Remove redundant return in set_huge_zero_folio()

PATCH Applied Dev Jain 2 participants 2 messages Mar 6, 2025

Subsystems (2)
lore
Share & tools
lore

Dev Jain

author reviewer
#0 lore raw

PATCH 1/1 mm: Remove redundant return in set_huge_zero_folio()

It is the responsibility of the caller to check pmd_none(); in any case, we are not achieving anything by returning since there is no return value to tell the caller that we succeeded or not. So remove this check.

---
 mm/huge_memory.c | 2 --
 1 file changed, 2 deletions(-)
mm/huge_memory.c +0 -2
index 3d3ebdc002d5..f64212d674fd 100644
@@ -1309,8 +1309,6 @@ static void set_huge_zero_folio(pgtable_t pgtable, struct mm_struct *mm,
 		struct folio *zero_folio)
 {
 	pmd_t entry;
-	if (!pmd_none(*pmd))
-		return;
 	entry = mk_pmd(&zero_folio->page, vma->vm_page_prot);
 	entry = pmd_mkhuge(entry);
 	pgtable_trans_huge_deposit(mm, pmd, pgtable);
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Dev Jain

It is the responsibility of the caller to check pmd_none(); in any case, we are not achieving anything by returning since there is no return value to tell the caller that we succeeded or not. So remove this check.

---
  mm/huge_memory.c | 2 --
  1 file changed, 2 deletions(-)
mm/huge_memory.c +0 -0
index 3d3ebdc002d5..f64212d674fd 100644

mm/huge_memory.c static void set_huge_zero_folio(pgtable_t pgtable, struct mm_struct *mm, · line 1314

Quoted 8 lines
mm/huge_memory.c +0 -2
@@ -1309,8 +1309,6 @@ static void set_huge_zero_folio(pgtable_t pgtable, struct mm_struct *mm,
  		struct folio *zero_folio)
  {
  	pmd_t entry;
-	if (!pmd_none(*pmd))
-		return;
  	entry = mk_pmd(&zero_folio->page, vma->vm_page_prot);
  	entry = pmd_mkhuge(entry);
  	pgtable_trans_huge_deposit(mm, pmd, pgtable);
Signature · 3 lines
Cheers,

David / dhildenb