Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1611821 > unrolled thread
| Started by | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| First post | 2017-03-29 13:00 +0200 |
| Last post | 2017-03-29 17:20 +0200 |
| Articles | 2 — 2 participants |
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.
Re: [PATCH 1/5] locking: Introduce range reader/writer lock Peter Zijlstra <peterz@infradead.org> - 2017-03-29 13:00 +0200
Re: [PATCH 1/5] locking: Introduce range reader/writer lock Davidlohr Bueso <dave@stgolabs.net> - 2017-03-29 17:20 +0200
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2017-03-29 13:00 +0200 |
| Subject | Re: [PATCH 1/5] locking: Introduce range reader/writer lock |
| Message-ID | <tqjux-5Ii-13@gated-at.bofh.it> |
On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote:
> +static __always_inline int
> +__range_read_lock_common(struct range_rwlock_tree *tree,
> + struct range_rwlock *lock, long state)
> +{
> + struct interval_tree_node *node;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&tree->lock, flags);
> + lock->reader = true;
> +
> + if (!__range_intersects_intree(tree, lock))
> + goto insert;
> +
> + node = interval_tree_iter_first(&tree->root, lock->node.start,
> + lock->node.last);
> + while (node) {
> + struct range_rwlock *blocked_lock;
> + blocked_lock = range_entry(node, struct range_rwlock, node);
> +
> + if (!blocked_lock->reader)
> + lock->blocking_ranges++;
> + node = interval_tree_iter_next(node, lock->node.start,
> + lock->node.last);
> + }
> +insert:
> + __range_tree_insert(tree, lock);
> +
> + lock->task = current;
> + spin_unlock_irqrestore(&tree->lock, flags);
> +
> + return wait_for_ranges(tree, lock, state);
> +}
Another thing; this implementation lacks lockdep annotations and has 0
other debugging features.
Is there something that makes the normal rwsem lockdep annotation not
work for this?
[toc] | [next] | [standalone]
| From | Davidlohr Bueso <dave@stgolabs.net> |
|---|---|
| Date | 2017-03-29 17:20 +0200 |
| Message-ID | <tqnya-ea-7@gated-at.bofh.it> |
| In reply to | #1611821 |
On Wed, 29 Mar 2017, Peter Zijlstra wrote:
>On Mon, Mar 06, 2017 at 09:03:26PM -0800, Davidlohr Bueso wrote:
>> +static __always_inline int
>> +__range_read_lock_common(struct range_rwlock_tree *tree,
>> + struct range_rwlock *lock, long state)
>> +{
>> + struct interval_tree_node *node;
>> + unsigned long flags;
>> +
>> + spin_lock_irqsave(&tree->lock, flags);
>> + lock->reader = true;
>> +
>> + if (!__range_intersects_intree(tree, lock))
>> + goto insert;
>> +
>> + node = interval_tree_iter_first(&tree->root, lock->node.start,
>> + lock->node.last);
>> + while (node) {
>> + struct range_rwlock *blocked_lock;
>> + blocked_lock = range_entry(node, struct range_rwlock, node);
>> +
>> + if (!blocked_lock->reader)
>> + lock->blocking_ranges++;
>> + node = interval_tree_iter_next(node, lock->node.start,
>> + lock->node.last);
>> + }
>> +insert:
>> + __range_tree_insert(tree, lock);
>> +
>> + lock->task = current;
>> + spin_unlock_irqrestore(&tree->lock, flags);
>> +
>> + return wait_for_ranges(tree, lock, state);
>> +}
>
>Another thing; this implementation lacks lockdep annotations and has 0
>other debugging features.
True.
>Is there something that makes the normal rwsem lockdep annotation not
>work for this?
Not that I know of. Let me look into it.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web