On 2014-09-12 12:38:48 +0300, Ants Aasma wrote: > On Thu, Sep 11, 2014 at 4:22 PM, Andres Freund <and...@2ndquadrant.com> wrote: > >> > Hm. Perhaps we should do a bufHdr->refcount != zero check without > >> > locking here? The atomic op will transfer the cacheline exclusively to > >> > the reclaimer's CPU. Even though it very shortly afterwards will be > >> > touched afterwards by the pinning backend. > >> > >> Meh. I'm not in favor of adding more funny games with locking unless > >> we can prove they're necessary for performance. > > > > Well, this in theory increases the number of processes touching buffer > > headers regularly. Currently, if you have one read IO intensive backend, > > there's pretty much only process touching the cachelines. This will make > > it two. I don't think it's unreasonable to try to reduce the cacheline > > pingpong caused by that... > > I don't think it will help much. A pinned buffer is pretty likely to > be in modified state in the cache of the cpu of the pinning backend.
Right. Unless you're on a MOESI platforms. I'd really like to know why that's not more widely used. > Even taking a look at the refcount will trigger a writeback and > demotion to shared state. When time comes to unpin the buffer the > cacheline must again be promoted to exclusive state introducing > coherency traffic. Not locking the buffer only saves transfering the > cacheline back to the pinning backend, not a huge amount of savings. Yes. But: In many, if not most, cases the cacheline will be read a couple times before modifying it via the spinlock. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers