From: | Jeff Davis <pgsql(at)j-davis(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Thom Brown <thom(at)linux(dot)com>, Peter Geoghegan <peter(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: memory barriers (was: Yes, WaitLatch is vulnerable to weak-memory-ordering bugs) |
Date: | 2011-09-22 23:46:17 |
Message-ID: | 1316735177.14517.13.camel@sussancws0025 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, 2011-09-22 at 19:12 -0400, Robert Haas wrote:
> But since you asked... as I
> understand it, unless you're running on Alpha, you actually don't need
> a barrier here at all, because all currently-used CPUs other than
> alpha "respect data dependencies", which means that if q->num_items is
> used to compute an address to be read from memory, the CPU will ensure
> that the read of that address is performed after the read of the value
> used to compute the address. At least that's my understanding. But
> Alpha won't.
I'm still trying to figure out how it's even possible to read an address
that's not computed yet. Something sounds strange about that...
I think it might have more to do with branch prediction or something
else. In your example, the address is not computed from q->num_items
directly, it's computed using "i". But that branch being followed is
dependent on a comparison with q->num_items. Maybe that's the dependency
that's not respected?
Regards,
Jeff Davis
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2011-09-23 01:11:54 | Re: memory barriers (was: Yes, WaitLatch is vulnerable to weak-memory-ordering bugs) |
Previous Message | Robert Haas | 2011-09-22 23:25:24 | Re: patch: plpgsql - remove unnecessary ccache search when a array variable is updated |