mm/hugepages: fix "orig_pud" set but not used
Subsystems (2)
PATCH v2 1/1 mm/hugepages: fix "orig_pud" set but not used
The commit a00cc7d9dd93 ("mm, x86: add support for PUD-sized transparent hugepages") introduced pudp_huge_get_and_clear_full() but no one uses its return code. In order to not diverge from pmdp_huge_get_and_clear_full(), just change zap_huge_pud() to not assign the return value from pudp_huge_get_and_clear_full().
mm/huge_memory.c: In function 'zap_huge_pud':mm/huge_memory.c:1982:8: warning: variable 'orig_pud' set but not used [-Wunused-but-set-variable]
pud_t orig_pud;
^~~~~~~~---
v2: keep returning a code from pudp_huge_get_and_clear_full() for possible
future uses.
mm/huge_memory.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
mm/huge_memory.c +1 -3
@@ -1979,7 +1979,6 @@ spinlock_t *__pud_trans_huge_lock(pud_t *pud, struct vm_area_struct *vma)int zap_huge_pud (struct mmu_gather *tlb,struct vm_area_struct *vma,pud_t *pud,unsigned long addr) { -pud_t orig_pud;spinlock_t *ptl; ptl =__pud_trans_huge_lock (pud, vma);
@@ -1991,8 +1990,7 @@ int zap_huge_pud(struct mmu_gather *tlb, struct vm_area_struct *vma,* pgtable_trans_huge_withdraw after finishing pudp related * operations. */ - orig_pud =pudp_huge_get_and_clear_full (tlb->mm, addr, pud, - tlb->fullmm); +pudp_huge_get_and_clear_full (tlb->mm, addr, pud, tlb->fullmm);tlb_remove_pud_tlb_entry (tlb, pud, addr);if (vma_is_dax (vma)) {spin_unlock (ptl);
Signature · 1 line
2.17.2 (Apple Git-113)
Quoted 7 lines · Qian Cai
The commit
a00cc7d9dd93("mm, x86: add support for PUD-sized transparent hugepages") introducedpudp_huge_get_and_clear_full()but no one uses its return code. In order to not diverge frompmdp_huge_get_and_clear_full(), just changezap_huge_pud()to not assign the return value frompudp_huge_get_and_clear_full().
Quoted 6 lines
mm/huge_memory.c: In function 'zap_huge_pud':mm/huge_memory.c:1982:8: warning: variable 'orig_pud' set but not used [-Wunused-but-set-variable]pud_t orig_pud; ^~~~~~~~
4th argument passed to pudp_huge_get_and_clear_full() is not used. Is it fine to remove *int full * in pudp_huge_get_and_clear_full() if there is no plan to use it in future ?
This is applicable to below functions as well -pmdp_huge_get_and_clear_full()ptep_get_and_clear_full()pte_clear_not_present_full()
Quoted 34 lines
Signed-off-by Qian Cai <[email protected]>---
v2: keep returning a code from
pudp_huge_get_and_clear_full()for possible
future uses.mm/huge_memory.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)mm/huge_memory.c +1
-4@@ -1979,7 +1979,6 @@ spinlock_t *__pud_trans_huge_lock(pud_t *pud, struct vm_area_struct *vma)int zap_huge_pud (struct mmu_gather *tlb,struct vm_area_struct *vma,pud_t *pud,unsigned long addr) { -pud_t orig_pud;spinlock_t *ptl; ptl =__pud_trans_huge_lock (pud, vma);@@ -1991,8 +1990,7 @@ int zap_huge_pud(struct mmu_gather *tlb, struct vm_area_struct *vma,* pgtable_trans_huge_withdraw after finishing pudp related * operations. */ - orig_pud =pudp_huge_get_and_clear_full (tlb->mm, addr, pud, - tlb->fullmm); +pudp_huge_get_and_clear_full (tlb->mm, addr, pud, tlb->fullmm);tlb_remove_pud_tlb_entry (tlb, pud, addr);if (vma_is_dax (vma)) {spin_unlock (ptl); --2.17.2 (Apple Git-113)
Quoted 15 lines · Souptick Joarder
Quoted 7 lines · Qian Cai
The commit
a00cc7d9dd93("mm, x86: add support for PUD-sized transparent hugepages") introducedpudp_huge_get_and_clear_full()but no one uses its return code. In order to not diverge frompmdp_huge_get_and_clear_full(), just changezap_huge_pud()to not assign the return value frompudp_huge_get_and_clear_full().Quoted 6 lines
mm/huge_memory.c: In function 'zap_huge_pud':mm/huge_memory.c:1982:8: warning: variable 'orig_pud' set but not used [-Wunused-but-set-variable]pud_t orig_pud; ^~~~~~~~
Quoted 8 lines
4th argument passed to
pudp_huge_get_and_clear_full()is not used. Is it fine to remove *int full * inpudp_huge_get_and_clear_full()if there is no plan to use it in future ?This is applicable to below functions as well -
pmdp_huge_get_and_clear_full()ptep_get_and_clear_full()pte_clear_not_present_full()
I suppose arches may override those that could make use of "int full".