Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1611713 > unrolled thread

Re: [PATCH 1/5] locking: Introduce range reader/writer lock

Started byPeter Zijlstra <peterz@infradead.org>
First post2017-03-29 11:20 +0200
Last post2017-03-29 11:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/5] locking: Introduce range reader/writer lock Peter Zijlstra <peterz@infradead.org> - 2017-03-29 11:20 +0200

#1611713 — Re: [PATCH 1/5] locking: Introduce range reader/writer lock

FromPeter Zijlstra <peterz@infradead.org>
Date2017-03-29 11:20 +0200
SubjectRe: [PATCH 1/5] locking: Introduce range reader/writer lock
Message-ID<tqhVL-4OF-5@gated-at.bofh.it>
On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote:
> +/*
> + * Implementation of read/write range locks.
> + *
> + * We keep interval tree of locked and to-be-locked ranges. When new range lock
> + * is requested, we add its interval to the tree and store number of intervals
> + * intersecting it to 'blocking_ranges'.
> + *
> + * When a range is unlocked, we again walk intervals that intersect with the
> + * unlocked one and decrement their 'blocking_ranges'. We wake up owner of any
> + * range lock whose 'blocking_ranges' drops to 0. For the shared case, the
> + * 'blocking_ranges' is only incremented if the intersecting range is not marked
> + * as a reader. 

Not a word about fairness and starvation... Such important topics for
lock primitives.

                   In order to mitigate some of the tree walk overhead for
> + * non-intersecting ranges, the tree's min/max values are maintained and consulted
> + * in O(1) in the fastpath.
> + */

Maybe that ought not be here, doesn't seem like a fundamental design
point and would thus be better suited for a comment near where this
implementation detail is located ?

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web