mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: cl@linux-foundation.org
To: linux-kernel@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>, David Howells <dhowells@redhat.com>,
	Ingo Molnar <mingo@elte.hu>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Eric Dumazet <dada1@cosmosbay.com>
Cc: davem@davemloft.net
Subject: [this_cpu_xx 05/11] this_cpu_ptr: Straight transformations
Date: Fri, 05 Jun 2009 15:18:24 -0400	[thread overview]
Message-ID: <20090605191851.201488971@gentwo.org> (raw)
In-Reply-To: <20090605191819.376530498@gentwo.org>

[-- Attachment #1: this_cpu_ptr_straight_transforms --]
[-- Type: text/plain, Size: 4260 bytes --]

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>
cc: Tejun 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: Christoph Lameter <cl@linux-foundation.org>

---
 drivers/infiniband/hw/ehca/ehca_irq.c       |    3 +--
 drivers/net/chelsio/sge.c                   |    5 ++---
 drivers/net/loopback.c                      |    2 +-
 fs/ext4/mballoc.c                           |    2 +-
 include/net/netfilter/nf_conntrack_ecache.h |    2 +-
 5 files changed, 6 insertions(+), 8 deletions(-)

Index: linux-2.6/drivers/net/chelsio/sge.c
===================================================================
--- linux-2.6.orig/drivers/net/chelsio/sge.c	2009-06-03 12:27:07.000000000 -0500
+++ linux-2.6/drivers/net/chelsio/sge.c	2009-06-03 12:38:53.000000000 -0500
@@ -1378,7 +1378,7 @@ static void sge_rx(struct sge *sge, stru
 	}
 	__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);
 	if ((adapter->flags & RX_CSUM_ENABLED) && p->csum == 0xffff &&
@@ -1780,8 +1780,7 @@ int t1_start_xmit(struct sk_buff *skb, s
 {
 	struct adapter *adapter = dev->ml_priv;
 	struct sge *sge = adapter->sge;
-	struct sge_port_stats *st = per_cpu_ptr(sge->port_stats[dev->if_port],
-						smp_processor_id());
+	struct sge_port_stats *st = this_cpu_ptr(sge->port_stats[dev->if_port]);
 	struct cpl_tx_pkt *cpl;
 	struct sk_buff *orig_skb = skb;
 	int ret;
Index: linux-2.6/drivers/net/loopback.c
===================================================================
--- linux-2.6.orig/drivers/net/loopback.c	2009-06-03 12:27:07.000000000 -0500
+++ linux-2.6/drivers/net/loopback.c	2009-06-03 12:38:53.000000000 -0500
@@ -78,7 +78,7 @@ static int loopback_xmit(struct sk_buff 
 
 	/* it's OK to use per_cpu_ptr() because BHs are off */
 	pcpu_lstats = dev->ml_priv;
-	lb_stats = per_cpu_ptr(pcpu_lstats, smp_processor_id());
+	lb_stats = this_cpu_ptr(pcpu_lstats);
 	lb_stats->bytes += skb->len;
 	lb_stats->packets++;
 
Index: linux-2.6/fs/ext4/mballoc.c
===================================================================
--- linux-2.6.orig/fs/ext4/mballoc.c	2009-06-03 12:27:07.000000000 -0500
+++ linux-2.6/fs/ext4/mballoc.c	2009-06-03 12:38:53.000000000 -0500
@@ -4210,7 +4210,7 @@ static void ext4_mb_group_or_file(struct
 	 * per cpu locality group is to reduce the contention between block
 	 * 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 */
 	ac->ac_flags |= EXT4_MB_HINT_GROUP_ALLOC;
Index: linux-2.6/include/net/netfilter/nf_conntrack_ecache.h
===================================================================
--- linux-2.6.orig/include/net/netfilter/nf_conntrack_ecache.h	2009-06-03 12:27:07.000000000 -0500
+++ linux-2.6/include/net/netfilter/nf_conntrack_ecache.h	2009-06-03 12:38:53.000000000 -0500
@@ -39,7 +39,7 @@ nf_conntrack_event_cache(enum ip_conntra
 	struct nf_conntrack_ecache *ecache;
 
 	local_bh_disable();
-	ecache = per_cpu_ptr(net->ct.ecache, raw_smp_processor_id());
+	ecache = __this_cpu_ptr(net->ct.ecache);
 	if (ct != ecache->ct)
 		__nf_ct_event_cache_init(ct);
 	ecache->events |= event;
Index: linux-2.6/drivers/infiniband/hw/ehca/ehca_irq.c
===================================================================
--- linux-2.6.orig/drivers/infiniband/hw/ehca/ehca_irq.c	2009-06-03 12:27:07.000000000 -0500
+++ linux-2.6/drivers/infiniband/hw/ehca/ehca_irq.c	2009-06-03 12:38:53.000000000 -0500
@@ -827,8 +827,7 @@ static void __cpuinit take_over_work(str
 		cq = list_entry(cct->cq_list.next, struct ehca_cq, entry);
 
 		list_del(&cq->entry);
-		__queue_comp_task(cq, per_cpu_ptr(pool->cpu_comp_tasks,
-						  smp_processor_id()));
+		__queue_comp_task(cq, this_cpu_ptr(pool->cpu_comp_tasks));
 	}
 
 	spin_unlock_irqrestore(&cct->task_lock, flags_cct);

-- 

  parent reply	other threads:[~2009-06-05 21:59 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-05 19:18 [this_cpu_xx 00/11] Introduce this_cpu_xx operations cl
2009-06-05 19:18 ` [this_cpu_xx 01/11] Introduce this_cpu_ptr() and generic this_cpu_* operations cl
2009-06-10  5:12   ` Tejun Heo
2009-06-11 15:10     ` Christoph Lameter
2009-06-12  2:09       ` Tejun Heo
2009-06-12 14:18         ` Christoph Lameter
2009-06-17  8:09           ` Tejun Heo
2009-06-17  8:19   ` Tejun Heo
2009-06-17 18:41     ` Christoph Lameter
2009-06-18  1:08       ` Tejun Heo
2009-06-18  3:01       ` Rusty Russell
2009-06-05 19:18 ` [this_cpu_xx 02/11] Use this_cpu operations for SNMP statistics cl
2009-06-05 19:18 ` [this_cpu_xx 03/11] Use this_cpu operations for NFS statistics cl
2009-06-05 19:18 ` [this_cpu_xx 04/11] Use this_cpu ops for network statistics cl
2009-06-08 11:27   ` Robin Holt
2009-06-08 20:49     ` Christoph Lameter
2009-06-08 20:54       ` Ingo Molnar
2009-06-05 19:18 ` cl [this message]
2009-06-05 19:18 ` [this_cpu_xx 06/11] Eliminate get/put_cpu cl
2009-06-05 19:34   ` Dan Williams
2009-06-09 14:02     ` Sosnowski, Maciej
2009-06-05 19:18 ` [this_cpu_xx 07/11] xfs_icsb_modify_counters does not need "cpu" variable cl
2009-06-05 19:22   ` Christoph Hellwig
2009-06-05 19:36     ` Christoph Lameter
2009-06-05 19:18 ` [this_cpu_xx 08/11] Use this_cpu_ptr in crypto subsystem cl
2009-06-05 19:18 ` [this_cpu_xx 09/11] X86 optimized this_cpu operations cl
2009-06-05 19:18 ` [this_cpu_xx 10/11] Use this_cpu ops for vm statistics cl
2009-06-05 19:18 ` [this_cpu_xx 11/11] RCU: Use this_cpu operations cl
2009-06-10 17:42   ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090605191851.201488971@gentwo.org \
    --to=cl@linux-foundation.org \
    --cc=dada1@cosmosbay.com \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rusty@rustcorp.com.au \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®