Date: Fri, 15 Dec 2000 11:02:05 -0800 (PST) From: John Baldwin <jhb@FreeBSD.org> To: Alfred Perlstein <bright@wintelcom.net> Cc: smp@FreeBSD.org, Julian Elischer <julian@elischer.org> Subject: Re: atomic increment? Message-ID: <XFMail.001215110205.jhb@FreeBSD.org> In-Reply-To: <20001215105605.S19572@fw.wintelcom.net>
index | next in thread | previous in thread | raw e-mail
On 15-Dec-00 Alfred Perlstein wrote: > * John Baldwin <jhb@FreeBSD.ORG> [001215 10:51] wrote: >> >> On 15-Dec-00 Julian Elischer wrote: >> > CAn we have an atomic increment and decrement primative? >> > >> > presently we get: >> > >> > .L565: >> > movl $1,%eax >> >#APP >> > lock >> > addl %eax,4(%ebx) >> > >> > >> > the movl is totally useless and it would be >> > an absolutly trivial addition.. >> > the question is; >> > is there a religious reason we don't already have it? >> >> man atomic > > I think he's looking for a useable and intuative interface. > > no offence I hope. :) I didn't come up with it. :) atomic_add_int(&my_int_var, 1) doesn't appear too weird to me. Of course, the movl being complained about is actually rather rediculous. It's in the instruction cache, so the '1' is a cache hit, and this instruction is probably all of 1 clock. Compared to the overhead of the bus lock, that is completely lost in the noise. Also, staring at the microcosm of the asm on one machine is not necessarily going to apply to other machines at all. -- John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the messagehelp
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.001215110205.jhb>
