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


Groups > linux.kernel > #1628000

Re: [PATCH 2/6] locking: Introduce range reader/writer lock

From Laurent Dufour <ldufour@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/6] locking: Introduce range reader/writer lock
Date 2017-04-21 09:10 +0200
Message-ID <tyARA-2SW-17@gated-at.bofh.it> (permalink)
References <ttbh9-6aP-61@gated-at.bofh.it> <ttbqO-6ei-37@gated-at.bofh.it> <txBPH-6OW-5@gated-at.bofh.it> <tymOD-2ES-33@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 20/04/2017 18:01, Davidlohr Bueso wrote:
>>> +int range_read_trylock(struct range_rwlock_tree *tree, struct
>>> range_rwlock *lock)
>>> +{
>>> +    int ret = true;
>>> +    unsigned long flags;
>>> +    struct interval_tree_node *node;
>>> +
>>> +    spin_lock_irqsave(&tree->lock, flags);
>>> +
>>> +    if (!__range_intersects_intree(tree, lock))
>>> +        goto insert;
>>> +
>>> +    /*
>>> +     * We have overlapping ranges in the tree, ensure that we can
>>> +     * in fact share the lock.
>>> +     */
>>> +    range_interval_tree_foreach(node, &tree->root,
>>> +                    lock->node.start, lock->node.last) {
>>> +        struct range_rwlock *blocked_lock;
>>> +        blocked_lock = range_entry(node, struct range_rwlock, node);
>>> +
>>> +        if (!range_lock_is_reader(blocked_lock)) {
>>> +            ret = false;
>>> +            goto unlock;
>>> +        }
>>> +    }
>>> +insert:
>>> +    range_lock_set_reader(lock);
>>
>> Here, the lock->waiter field should have been set to current before
>> calling range_lock_set_reader()
> 
> But this is a trylock attempt, there is no waiting going on.

Agreed, this one is useless.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH 2/6] locking: Introduce range reader/writer lock Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-04-18 16:00 +0200
  Re: [PATCH 2/6] locking: Introduce range reader/writer lock Davidlohr Bueso <dave@stgolabs.net> - 2017-04-20 18:10 +0200
    Re: [PATCH 2/6] locking: Introduce range reader/writer lock Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-04-21 09:10 +0200

csiph-web