Skip to contentSkip to conversation

MIPS: Get rid of some #ifdefery in arch/mips/mm/tlb-r4k.c

PATCH Superseded David Daney 3 participants 3 messages Nov 18, 2011 – Nov 21, 2011 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: Get rid of some #ifdefery in arch/mips/mm/tlb-r4k.c

From: David Daney <[email protected]>

In the case of !CONFIG_HUGETLB_PAGE, in linux/hugetlb.h we have this definition:

The other huge page constants in the if(pmd_huge()) block are likewise defined, so we can get rid of the #ifdef CONFIG_HUGETLB_PAGE an let the compiler optimize this block away instead. Doing this the code has a much cleaner appearance.

---
 arch/mips/mm/tlb-r4k.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
arch/mips/mm/tlb-r4k.c +2 -4
index 88dc49c..f93af98 100644
@@ -305,7 +305,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte)
 	pudp = pud_offset(pgdp, address);
 	pmdp = pmd_offset(pudp, address);
 	idx = read_c0_index();
-#ifdef CONFIG_HUGETLB_PAGE
+
 	/* this could be a huge page  */
 	if (pmd_huge(*pmdp)) {
 		unsigned long lo;
@@ -321,9 +321,7 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte)
 		else
 			tlb_write_indexed();
 		write_c0_pagemask(PM_DEFAULT_MASK);
-	} else
-#endif
-	{
+	} else {
 		ptep = pte_offset_map(pmdp, address);
 
 #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
Signature · 1 line
1.7.2.3
#1 lore raw

Hello.

Quoted 4 lines · David Daney

From: David Daney<[email protected]>

In the case of !CONFIG_HUGETLB_PAGE, in linux/hugetlb.h we have this definition:

Missed it?

Quoted 6 lines

The other huge page constants in the if(pmd_huge()) block are likewise defined, so we can get rid of the #ifdef CONFIG_HUGETLB_PAGE an let the compiler optimize this block away instead. Doing this the code has a much cleaner appearance.

WBR, Sergei

#2 lore raw
Quoted 10 lines · Sergei Shtylyov

Hello.

Quoted 4 lines · David Daney

From: David Daney<[email protected]>

In the case of !CONFIG_HUGETLB_PAGE, in linux/hugetlb.h we have this definition:

Missed it?

Indeed, I could swear that I put '#define pmd_huge(x) 0' in that commit log, but it is not there. The string was even still highlighted in my editor. At this point I blame the 'git commit' command for erasing that line.

David Daney

Quoted 10 lines
Quoted 7 lines

The other huge page constants in the if(pmd_huge()) block are likewise defined, so we can get rid of the #ifdef CONFIG_HUGETLB_PAGE an let the compiler optimize this block away instead. Doing this the code has a much cleaner appearance.

WBR, Sergei