Date: Fri, 14 Oct 2005 13:34:43 +0400 From: Denis Antrushin <DAntrushin@mail.ru> Cc: freebsd-current@freebsd.org Subject: Re: ufsstat - testers / feedback wanted! Message-ID: <434F7BB3.5020808@mail.ru> In-Reply-To: <20051014091004.GC18513@uk.tiscali.com> References: <434E46C0.7060903@centtech.com> <200510131412.23525.max@love2party.net> <20051013181026.GB27418@odin.ac.hmc.edu> <20051014091004.GC18513@uk.tiscali.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Brian Candler wrote: > On Thu, Oct 13, 2005 at 11:10:26AM -0700, Brooks Davis wrote: > >>>I don't think you can measure one single interger (or 64bit) increase in face >>>of a operation that has to access backing store. Even if there is a >>>performance hit, you don't have to build your kernel with the option enabled. >> >>The one thing I'd be worried about here is that 64bit updates are >>expensive on 32bit machines if you want them to be atomic. Relative to >>backing store they probably still don't matter, but the might be >>noticable. > > > I'd be grateful if you could clarify that point for me. Are you saying that > if I write > > long long foo; > ... > foo++; > > then the C compiler generates code for 'foo++' which is not thread-safe? > (And therefore I would have to protect it with a mutex or critical section) Yes. On 32-bit it looks something like that: cltd movl $1 %eax movl $0, %edx addl -16(%ebp), %eax adcl -12(%ebp), %edx movl %eax, -16(%ebp) movl %edx, -12(%ebp) > Or are you saying that the C compiler inserts its own code around foo++ to > turn it into a critical section, and therefore runs less efficiently than > you'd expect? C compilers not that smart yet, AFAIK :-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?434F7BB3.5020808>