Re: Question on atomic_inc/dec

From: sankar
Date: Wed Oct 15 2003 - 12:35:38 EST


Hi,
any solution to the original problem???
(atomic_inc() defintion not there in redhat 9.0 asm/atomic.h)
----- Original Message -----
From: "Perez-Gonzalez, Inaky" <inaky.perez-gonzalez@xxxxxxxxx>
To: "Tim Hockin" <thockin@xxxxxxxxxx>
Cc: "sankar" <san_madhav@xxxxxxxxxxx>; <linux-kernel@xxxxxxxxxxxxxxx>
Sent: Tuesday, October 14, 2003 3:29 PM
Subject: RE: Question on atomic_inc/dec


> From: Tim Hockin [mailto:thockin@xxxxxxxxxx]
>
> On Tue, Oct 14, 2003 at 02:17:49PM -0700, Perez-Gonzalez, Inaky wrote:
> > It will be in include/asm/atomic.h; however, it is not wise to
> > use directly the kernel stuff unless you are coding kernel stuff.
>
> Is there any reason NOT to use the atomic ops in user-space? I mean, are
> they privileged on some architectures, or ...? It seems like some
> user-space apps might really benefit from simple atomic ops. Or at least,
> kernel-coders writing in userspace could sure use simple atomic ops :)

Well, you are right; functionally speaking, there are no concerns,
however, there are problems.

Not all architectures have really simple atomic operations like
for example, ia32 or PPC. For example, Sparc has to do this ugly
spinlock thinguie and that's why you can only count on 24 bits
out of the whole atomic data type; another example is ARM,
you just disables irqs and preemption, I guess, and operates), there
is no way they will work in user space

When you have implementations like this, where ia32 is one of the
lucky exceptions because you can do it with a couple of asm opcodes,
it is really impossible to offer something that can float up to
user space.

PS: hey, how's Mike doing? Say hi from me, pls

Iñaky Pérez-González -- Not speaking for Intel -- all opinions are my own
(and my fault)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/