[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v10 07/19] qspinlock: Use a simple write to grab the lock, if applicable

On 05/08/2014 03:00 PM, Peter Zijlstra wrote:
On Wed, May 07, 2014 at 11:01:35AM -0400, Waiman Long wrote:
@@ -94,23 +94,29 @@ static inline struct mcs_spinlock *decode_tail(u32 tail)
   * can allow better optimization of the lock acquisition for the pending
   * bit holder.
-#if _Q_PENDING_BITS == 8
  struct __qspinlock {
        union {
                atomic_t val;
-               struct {
  #ifdef __LITTLE_ENDIAN
+               u8       locked;
+               struct {
                        u16     locked_pending;
                        u16     tail;
+               };
+               struct {
                        u16     tail;
                        u16     locked_pending;
+               struct {
+                       u8      reserved[3];
+                       u8      locked;
+               };

+#if _Q_PENDING_BITS == 8
That doesn't make sense, that struct __qspinlock only makes sense when

I need to use the locked field (the 2nd strcut) in get_qlock() where I grab the lock by setting the lock byte directly. Since the endian-aware structure is already in place, I reused it and have to expose it even when _Q_PENDING_BITS isn't 8. I will document that more clearly in the code to avoid this confusion.


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.