Skip to contentSkip to conversation

net: core: use this_cpu_ptr per-cpu helper

PATCH Applied Shan Wei 2 participants 3 messages Nov 13, 2012 – Nov 20, 2012

Subsystems (2)
lore
Share & tools
lore

Shan Wei

author
#0 lore raw

PATCH v4 1/9 net: core: use this_cpu_ptr per-cpu helper

From: Shan Wei <[email protected]>

flush_tasklet is a struct, not a pointer in percpu var. so use this_cpu_ptr to get the member pointer.

---
no changes vs v3.

---
 net/core/flow.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
net/core/flow.c +1 -3
index e318c7e..b0901ee 100644
@@ -327,11 +327,9 @@ static void flow_cache_flush_tasklet(unsigned long data)
 static void flow_cache_flush_per_cpu(void *data)
 {
 	struct flow_flush_info *info = data;
-	int cpu;
 	struct tasklet_struct *tasklet;
 
-	cpu = smp_processor_id();
-	tasklet = &per_cpu_ptr(info->cache->percpu, cpu)->flush_tasklet;
+	tasklet = this_cpu_ptr(&info->cache->percpu->flush_tasklet);
 	tasklet->data = (unsigned long)info;
 	tasklet_schedule(tasklet);
 }
Signature · 1 line
1.7.1
author
#1 lore raw

Shan Wei said, at 2012/11/13 9:51:

Quoted 7 lines

From: Shan Wei <[email protected]>

flush_tasklet is a struct, not a pointer in percpu var. so use this_cpu_ptr to get the member pointer.

David Miller, would you like to pick it up to your net-next tree?

Quoted 24 lines

---
no changes vs v3.

---
 net/core/flow.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
net/core/flow.c +1 -3
index e318c7e..b0901ee 100644
@@ -327,11 +327,9 @@ static void flow_cache_flush_tasklet(unsigned long data)
 static void flow_cache_flush_per_cpu(void *data)
 {
 	struct flow_flush_info *info = data;
-	int cpu;
 	struct tasklet_struct *tasklet;
 
-	cpu = smp_processor_id();
-	tasklet = &per_cpu_ptr(info->cache->percpu, cpu)->flush_tasklet;
+	tasklet = this_cpu_ptr(&info->cache->percpu->flush_tasklet);
 	tasklet->data = (unsigned long)info;
 	tasklet_schedule(tasklet);
 }
maintainer Applied
#2 lore raw

From: Shan Wei <[email protected]>
Date: Fri, 16 Nov 2012 16:38:01 +0800

Quoted 10 lines

Shan Wei said, at 2012/11/13 9:51:

Quoted 7 lines

From: Shan Wei <[email protected]>

flush_tasklet is a struct, not a pointer in percpu var. so use this_cpu_ptr to get the member pointer.

David Miller, would you like to pick it up to your net-next tree?

Applied.