From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Ants Aasma <ants(at)cybertec(dot)at>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Atri Sharma <atri(dot)jiit(at)gmail(dot)com>, Greg Stark <stark(at)mit(dot)edu>, Amit Kapila <amit(dot)kapila(at)huawei(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Page replacement algorithm in buffer cache |
Date: | 2013-04-01 20:32:49 |
Message-ID: | 20130401203249.GA11288@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Apr 1, 2013 at 11:55:07AM -0500, Merlin Moncure wrote:
> > In fact, BufFreelistLock is really misnamed, because for the most
> > part, the "free list" as we implement is going to be empty. What the
> > BufFreelistLock is really doing is serializing the process of scanning
> > for a free buffer. I think THAT is the problem. If we could arrange
> > things so as to hold BufFreelistLock only for the amount of time
> > needed to remove a buffer from a freelist ... we'd probably buy
> > ourselves quite a bit.
>
> right. I'm imaging a buffer scan loop that looks something like
> (uncompiled, untested) this. "TryLockBufHdr" does a simple TAS
> without spin, returning the lock state (well, true if it acquired the
> lock). usage_count is specifically and deliberately adjusted without
> having a lock on the buffer header (this would require some careful
> testing and possible changes elsewhere):
TAS does a CPU 'lock' instruction which affects the cpu cache. Why not
just read the value with no lock?
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2013-04-01 20:53:21 | Re: "Orphaned" files after initdb |
Previous Message | Robert Haas | 2013-04-01 19:41:14 | Re: [sepgsql 2/3] Add db_schema:search permission checks |