Re: [PATCH v4 2/7] locking/pvqspinlock: Add pending bit support

From: Waiman Long
Date: Mon Aug 03 2015 - 17:30:23 EST


On 08/03/2015 02:37 PM, Davidlohr Bueso wrote:
On Fri, 2015-07-31 at 22:21 -0400, Waiman Long wrote:
/*
+ * Try to acquire the lock and wait using the pending bit
+ */
+static int pv_pending_lock(struct qspinlock *lock, u32 val)
Sorry but, why did yo not rewrite the function as we had previously
discussed. This is very confusing to read, the one I suggested follows a
much nicer flow and purposely illustrates the intention. You also failed
to address my loop semantics concerns altogether.

Thanks,
Davidlohr


I am sorry that I might have misinterpret what you wanted. Right now, the latest code have 3 loops in the pending function:
1. Waiting for pending locker to become lock holder
2. A loop to do the trylock or set the pending bit.
3. With the pending bit set, another loop to wait until the lock holder frees the lock.

The 2nd loop may be a bit confusing to look at. I will try to add more comment to clarify that. The second loop can return without calling clear_pending() because the pending bit will not be set until it breaks out of the loop.

I think it will make the code more complicated if we try to merge the 2nd and 3rd loops.

Please let me know what kind of rewriting you have in mind.

Thanks,
Longman




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/