netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ravikiran G Thirumalai <kiran@scalex86.org>
To: Andrew Morton <akpm@osdl.org>
Cc: bcrl@kvack.org, linux-kernel@vger.kernel.org,
	davem@davemloft.net, netdev@vger.kernel.org, shai@scalex86.org,
	Andi Kleen <ak@suse.de>
Subject: Re: [patch 1/4] net: percpufy frequently used vars -- add percpu_counter_mod_bh
Date: Thu, 9 Mar 2006 00:06:51 -0800	[thread overview]
Message-ID: <20060309080651.GA3599@localhost.localdomain> (raw)
In-Reply-To: <20060308163258.36f3bd79.akpm@osdl.org>

On Wed, Mar 08, 2006 at 04:32:58PM -0800, Andrew Morton wrote:
> Ravikiran G Thirumalai <kiran@scalex86.org> wrote:
> >
> > On Wed, Mar 08, 2006 at 03:43:21PM -0800, Andrew Morton wrote:
> > > Benjamin LaHaise <bcrl@kvack.org> wrote:
> > > >
> > > > I think it may make more sense to simply convert local_t into a long, given 
> > > > that most of the users will be things like stats counters.
> > > > 
> > > 
> > > Yes, I agree that making local_t signed would be better.  It's consistent
> > > with atomic_t, atomic64_t and atomic_long_t and it's a bit more flexible.
> > > 
> > > Perhaps.  A lot of applications would just be upcounters for statistics,
> > > where unsigned is desired.  But I think the consistency argument wins out.
> > 
> > It already is... for most of the arches except x86_64.
> 
> x86 uses unsigned long.

Here's a patch making x86_64 local_t to 64 bits like other 64 bit arches.
This keeps local_t unsigned long.  (We can change it to signed value 
along with other arches later in one go I guess) 

Thanks,
Kiran


Change x86_64 local_t to 64 bits like all other arches.

Signed-off-by: Ravikiran Thirumalai <kiran@scalex86.org>

Index: linux-2.6.16-rc5mm3/include/asm-x86_64/local.h
===================================================================
--- linux-2.6.16-rc5mm3.orig/include/asm-x86_64/local.h	2006-03-08 16:51:31.000000000 -0800
+++ linux-2.6.16-rc5mm3/include/asm-x86_64/local.h	2006-03-08 21:56:01.000000000 -0800
@@ -5,18 +5,18 @@
 
 typedef struct
 {
-	volatile unsigned int counter;
+	volatile long counter;
 } local_t;
 
 #define LOCAL_INIT(i)	{ (i) }
 
-#define local_read(v)	((v)->counter)
+#define local_read(v)	((unsigned long)(v)->counter)
 #define local_set(v,i)	(((v)->counter) = (i))
 
 static __inline__ void local_inc(local_t *v)
 {
 	__asm__ __volatile__(
-		"incl %0"
+		"incq %0"
 		:"=m" (v->counter)
 		:"m" (v->counter));
 }
@@ -24,7 +24,7 @@ static __inline__ void local_inc(local_t
 static __inline__ void local_dec(local_t *v)
 {
 	__asm__ __volatile__(
-		"decl %0"
+		"decq %0"
 		:"=m" (v->counter)
 		:"m" (v->counter));
 }
@@ -32,7 +32,7 @@ static __inline__ void local_dec(local_t
 static __inline__ void local_add(unsigned int i, local_t *v)
 {
 	__asm__ __volatile__(
-		"addl %1,%0"
+		"addq %1,%0"
 		:"=m" (v->counter)
 		:"ir" (i), "m" (v->counter));
 }
@@ -40,7 +40,7 @@ static __inline__ void local_add(unsigne
 static __inline__ void local_sub(unsigned int i, local_t *v)
 {
 	__asm__ __volatile__(
-		"subl %1,%0"
+		"subq %1,%0"
 		:"=m" (v->counter)
 		:"ir" (i), "m" (v->counter));
 }
@@ -71,4 +71,4 @@ static __inline__ void local_sub(unsigne
 #define __cpu_local_add(i, v)	cpu_local_add((i), (v))
 #define __cpu_local_sub(i, v)	cpu_local_sub((i), (v))
 
-#endif /* _ARCH_I386_LOCAL_H */
+#endif /* _ARCH_X8664_LOCAL_H */

  reply	other threads:[~2006-03-09  8:06 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-08  1:58 [patch 0/4] net: percpufy frequently used vars on struct proto Ravikiran G Thirumalai
2006-03-08  1:59 ` [patch 1/4] net: percpufy frequently used vars -- add percpu_counter_mod_bh Ravikiran G Thirumalai
2006-03-08  2:13   ` Andrew Morton
2006-03-08 20:26     ` Ravikiran G Thirumalai
2006-03-08 20:36       ` Benjamin LaHaise
2006-03-08 21:07         ` Ravikiran G Thirumalai
2006-03-08 21:17           ` Benjamin LaHaise
2006-03-08 22:25             ` Ravikiran G Thirumalai
2006-03-08 22:41               ` Benjamin LaHaise
2006-03-08 23:43                 ` Andrew Morton
2006-03-09  0:18                   ` Ravikiran G Thirumalai
2006-03-09  0:32                     ` Andrew Morton
2006-03-09  8:06                       ` Ravikiran G Thirumalai [this message]
2006-03-09  4:14                         ` Andi Kleen
2006-03-09  8:14                         ` Nick Piggin
2006-03-09  8:22                           ` Ravikiran G Thirumalai
2006-03-09  8:41                             ` Nick Piggin
2006-03-09 18:39                               ` Benjamin LaHaise
2006-03-08 23:06               ` Andrew Morton
2006-03-08 23:12                 ` Andrew Morton
2006-03-09  2:21                 ` Andi Kleen
2006-03-09  2:32                   ` Andrew Morton
2006-03-08  2:01 ` [patch 2/4] net: percpufy frequently used vars -- struct proto.memory_allocated Ravikiran G Thirumalai
2006-03-08  2:14   ` Andrew Morton
2006-03-08  3:08     ` Ravikiran G Thirumalai
2006-03-08  3:22       ` Andrew Morton
2006-03-08 20:54         ` Ravikiran G Thirumalai
2006-03-08  2:02 ` [patch 3/4] net: percpufy frequently used vars -- proto.sockets_allocated Ravikiran G Thirumalai
2006-03-08  2:16   ` Andrew Morton
2006-03-08 20:56     ` Ravikiran G Thirumalai
2006-03-08  2:03 ` [patch 4/4] net: percpufy frequently used vars -- proto.inuse Ravikiran G Thirumalai

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=20060309080651.GA3599@localhost.localdomain \
    --to=kiran@scalex86.org \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=bcrl@kvack.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shai@scalex86.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;
as well as URLs for NNTP newsgroup(s).