Commit ca0c9584 authored by Christoph Lameter's avatar Christoph Lameter Committed by Tejun Heo

this_cpu: Straight transformations

Use this_cpu_ptr and __this_cpu_ptr in locations where straight
transformations are possible because per_cpu_ptr is used with
either smp_processor_id() or raw_smp_processor_id().

cc: David Howells <dhowells@redhat.com>
Acked-by: default avatarTejun Heo <tj@kernel.org>
cc: Ingo Molnar <mingo@elte.hu>
cc: Rusty Russell <rusty@rustcorp.com.au>
cc: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: default avatarChristoph Lameter <cl@linux-foundation.org>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 4ea7334b
...@@ -826,8 +826,7 @@ static void __cpuinit take_over_work(struct ehca_comp_pool *pool, int cpu) ...@@ -826,8 +826,7 @@ static void __cpuinit take_over_work(struct ehca_comp_pool *pool, int cpu)
cq = list_entry(cct->cq_list.next, struct ehca_cq, entry); cq = list_entry(cct->cq_list.next, struct ehca_cq, entry);
list_del(&cq->entry); list_del(&cq->entry);
__queue_comp_task(cq, per_cpu_ptr(pool->cpu_comp_tasks, __queue_comp_task(cq, this_cpu_ptr(pool->cpu_comp_tasks));
smp_processor_id()));
} }
spin_unlock_irqrestore(&cct->task_lock, flags_cct); spin_unlock_irqrestore(&cct->task_lock, flags_cct);
......
...@@ -1378,7 +1378,7 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len) ...@@ -1378,7 +1378,7 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len)
} }
__skb_pull(skb, sizeof(*p)); __skb_pull(skb, sizeof(*p));
st = per_cpu_ptr(sge->port_stats[p->iff], smp_processor_id()); st = this_cpu_ptr(sge->port_stats[p->iff]);
skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev); skb->protocol = eth_type_trans(skb, adapter->port[p->iff].dev);
if ((adapter->flags & RX_CSUM_ENABLED) && p->csum == 0xffff && if ((adapter->flags & RX_CSUM_ENABLED) && p->csum == 0xffff &&
...@@ -1780,8 +1780,7 @@ netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1780,8 +1780,7 @@ netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct adapter *adapter = dev->ml_priv; struct adapter *adapter = dev->ml_priv;
struct sge *sge = adapter->sge; struct sge *sge = adapter->sge;
struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[dev->if_port], struct sge_port_stats *st = this_cpu_ptr(sge->port_stats[dev->if_port]);
smp_processor_id());
struct cpl_tx_pkt *cpl; struct cpl_tx_pkt *cpl;
struct sk_buff *orig_skb = skb; struct sk_buff *orig_skb = skb;
int ret; int ret;
......
...@@ -81,7 +81,7 @@ static netdev_tx_t loopback_xmit(struct sk_buff *skb, ...@@ -81,7 +81,7 @@ static netdev_tx_t loopback_xmit(struct sk_buff *skb,
/* it's OK to use per_cpu_ptr() because BHs are off */ /* it's OK to use per_cpu_ptr() because BHs are off */
pcpu_lstats = dev->ml_priv; pcpu_lstats = dev->ml_priv;
lb_stats = per_cpu_ptr(pcpu_lstats, smp_processor_id()); lb_stats = this_cpu_ptr(pcpu_lstats);
len = skb->len; len = skb->len;
if (likely(netif_rx(skb) == NET_RX_SUCCESS)) { if (likely(netif_rx(skb) == NET_RX_SUCCESS)) {
......
...@@ -3932,7 +3932,7 @@ static void ext4_mb_group_or_file(struct ext4_allocation_context *ac) ...@@ -3932,7 +3932,7 @@ static void ext4_mb_group_or_file(struct ext4_allocation_context *ac)
* per cpu locality group is to reduce the contention between block * per cpu locality group is to reduce the contention between block
* request from multiple CPUs. * request from multiple CPUs.
*/ */
ac->ac_lg = per_cpu_ptr(sbi->s_locality_groups, raw_smp_processor_id()); ac->ac_lg = __this_cpu_ptr(sbi->s_locality_groups);
/* we're going to use group allocation */ /* we're going to use group allocation */
ac->ac_flags |= EXT4_MB_HINT_GROUP_ALLOC; ac->ac_flags |= EXT4_MB_HINT_GROUP_ALLOC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment