Re: Lockless uidinfo.
- From: Pawel Jakub Dawidek <pjd@xxxxxxxxxxx>
- Date: Fri, 24 Aug 2007 16:09:27 +0200
On Wed, Aug 22, 2007 at 09:02:53PM +0200, Attilio Rao wrote:
2007/8/21, Pawel Jakub Dawidek <pjd@xxxxxxxxxxx>:
New patch is here:
http://people.freebsd.org/~pjd/patches/uidinfo_waitfree.patch
--- sys/ia64/include/atomic.h.orig
+++ sys/ia64/include/atomic.h
@@ -370,4 +370,15 @@
#define atomic_fetchadd_int atomic_fetchadd_32
+static __inline u_long
+atomic_fetchadd_long(volatile u_long *p, u_long v)
+{
+ u_long value;
+
+ do {
+ value = *p;
+ } while (!atomic_cmpset_64(p, value, value + v));
+ return (value);
+}
+
In cycles like those, as you get spinning, I would arrange things in
order to do a cpu_spinwait(). Like this:
for (;;) {
value = *p;
if (atomic_cmpset_64(p, value, value + v))
break;
cpu_spinwait();
}
In this case there is no difference as this is MI ia64 code and
cpu_spinwait() is defined as /* nothing */ there. As a general rule,
this might be a good idea.
--
Pawel Jakub Dawidek http://www.wheel.pl
pjd@xxxxxxxxxxx http://www.FreeBSD.org
FreeBSD committer Am I Evil? Yes, I Am!
Attachment:
pgpRls5SGUoeM.pgp
Description: PGP signature
- Follow-Ups:
- Re: Lockless uidinfo.
- From: Kris Kennaway
- Re: Lockless uidinfo.
- References:
- Lockless uidinfo.
- From: Pawel Jakub Dawidek
- Re: Lockless uidinfo.
- From: Alfred Perlstein
- Re: Lockless uidinfo.
- From: Pawel Jakub Dawidek
- Re: Lockless uidinfo.
- From: John Baldwin
- Re: Lockless uidinfo.
- From: Pawel Jakub Dawidek
- Re: Lockless uidinfo.
- From: Pawel Jakub Dawidek
- Re: Lockless uidinfo.
- From: Attilio Rao
- Lockless uidinfo.
- Prev by Date: Re: Lockless uidinfo.
- Next by Date: Re: Lockless uidinfo.
- Previous by thread: Re: Lockless uidinfo.
- Next by thread: Re: Lockless uidinfo.
- Index(es):
Relevant Pages
|
|