Re: Wait free LW_SHARED acquisition - v0.9
От | Robert Haas |
---|---|
Тема | Re: Wait free LW_SHARED acquisition - v0.9 |
Дата | |
Msg-id | CA+Tgmobtjgnx9zV9U7VsQddwWm9FfyMpNFkUoqB_atuKFnRbJQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Wait free LW_SHARED acquisition - v0.9 (Andres Freund <andres@2ndquadrant.com>) |
Ответы |
Re: Wait free LW_SHARED acquisition - v0.9
|
Список | pgsql-hackers |
On Wed, Oct 8, 2014 at 9:35 AM, Andres Freund <andres@2ndquadrant.com> wrote: > 2) Implement the wait free LW_SHARED algorithm. + * too high for workloads/locks that were locked in shared mode very s/locked/taken/? + * frequently. Often we were spinning in the (obviously exlusive) spinlock, exclusive. + * acquiration for locks that aren't exclusively locked. acquisition. + * For exlusive lock acquisition we use an atomic compare-and-exchange on the exclusive. + * lockcount variable swapping in EXCLUSIVE_LOCK/1<<31-1/0x7FFFFFFF if and only Add comma after variable. Find some way of describing the special value (maybe "a sentinel value, EXCLUSIVE_LOCK") just once, instead of three times. + * if the current value of lockcount is 0. If the swap was not successfull, we successful. + * by 1 again. If so, we have to wait for the exlusive locker to release the exclusive. + * The attentive reader probably might have noticed that naively doing the "probably might" is redundant. Delete probably. + * notice that we have to wait. Unfortunately until we have finished queuing, until -> by the time + * Phase 2: Add us too the waitqueue of the lock too -> to. And maybe us -> ourselves. + * get queued in Phase 2 and we can wake them up if neccessary or they will necessary. + * When acquiring shared locks it's possible that we disturb an exclusive + * waiter. If that's a problem for the specific user, pass in a valid pointer + * for 'potentially_spurious'. Its value will be set to true if we possibly + * did so. The caller then has to handle that scenario. "disturb" is not clear enough. + /* yipeyyahee */ Although this will be clear to individuals with a good command of English, I suggest avoiding such usages. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
В списке pgsql-hackers по дате отправления: