Re: [ANNOUNCE] mdb: Merkey's Linux Kernel Debugger 2.6.27-rc4 released

From: Avi Kivity
Date: Thu Aug 21 2008 - 12:22:02 EST


Peter Zijlstra wrote:
Not sure - I think all barrier clobber the full register and memory set.
So if you access a variable after a barrier it will have to issue a
load.

IIRC a barrier only clobbers memory. gcc must reload a variable from memory unless it can prove the variable's address has not escaped anywhere.

So:

void f()
{
int v;

v = g();
barrier();
do_domething_with(v);
}

Need not reload v from memory (indeed, v can be in a register for its entire lifetime), but

void f()
{
int v;

v = g();
h(&v);
barrier();
do_domething_with(v);
}

Will force v into memory, and reload it after the barrier.

--
error compiling committee.c: too many arguments to function

--
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/