Skip to contentSkip to conversation

arm64: mm: Drop the unused cpu parameter

PATCH New Shaokun Zhang 2 participants 3 messages Oct 6, 2018 – Oct 9, 2018 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: mm: Drop the unused cpu parameter

Cpu parameter is never used in flush_context, remove it.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/mm/context.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/mm/context.c +4 -4
index c127f94..009a7b2c 100644
@@ -88,7 +88,7 @@ void verify_cpu_asid_bits(void)
 	}
 }
 
-static void flush_context(unsigned int cpu)
+static void flush_context(void)
 {
 	int i;
 	u64 asid;
@@ -142,7 +142,7 @@ static bool check_update_reserved_asid(u64 asid, u64 newasid)
 	return hit;
 }
 
-static u64 new_context(struct mm_struct *mm, unsigned int cpu)
+static u64 new_context(struct mm_struct *mm)
 {
 	static u32 cur_idx = 1;
 	u64 asid = atomic64_read(&mm->context.id);
@@ -180,7 +180,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu)
 	/* We're out of ASIDs, so increment the global generation count */
 	generation = atomic64_add_return_relaxed(ASID_FIRST_VERSION,
 						 &asid_generation);
-	flush_context(cpu);
+	flush_context();
 
 	/* We have more ASIDs than CPUs, so this will always succeed */
 	asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, 1);
@@ -223,7 +223,7 @@ void check_and_switch_context(struct mm_struct *mm, unsigned int cpu)
 	/* Check that our ASID belongs to the current generation. */
 	asid = atomic64_read(&mm->context.id);
 	if ((asid ^ atomic64_read(&asid_generation)) >> asid_bits) {
-		asid = new_context(mm, cpu);
+		asid = new_context(mm);
 		atomic64_set(&mm->context.id, asid);
 	}
 
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 arm64: mm: Drop the unused cpu parameter

Quoted 8 lines · Shaokun Zhang

Cpu parameter is never used in flush_context, remove it.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/mm/context.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Curious, but does this actually result in better code generation, or does GCC already figure out that the parameter is unused?

Will

#2 lore raw

PATCH 1/1 arm64: mm: Drop the unused cpu parameter

Hi Will,

Quoted 10 lines · Will Deacon
Quoted 8 lines · Shaokun Zhang

Cpu parameter is never used in flush_context, remove it.

Cc Catalin Marinas <[email protected]>
Cc Will Deacon <[email protected]>
---
 arch/arm64/mm/context.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Quoted 5 lines

Curious, but does this actually result in better code generation, or does GCC already figure out that the parameter is unused?

No hint from GCC compiler, the unused parameter is found when debug one context switch issue and analyze the code. It is redundant and harmless to remove it, a trivial patch.

Thanks,
Shaokun

Quoted 4 lines

Will

.