[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140131100348.8867.qmail@science.horizon.com>
Date: 31 Jan 2014 05:03:48 -0500
From: "George Spelvin" <linux@...izon.com>
To: peterz@...radead.org, Waiman.Long@...com
Cc: akpm@...ux-foundation.org, andi@...stfloor.org, arnd@...db.de,
aswin@...com, hpa@...or.com, linux-arch@...r.kernel.org,
linux-kernel@...r.kernel.org, linux@...izon.com, mingo@...hat.com,
paulmck@...ux.vnet.ibm.com, raghavendra.kt@...ux.vnet.ibm.com,
riel@...hat.com, rostedt@...dmis.org, scott.norton@...com,
tglx@...utronix.de, tim.c.chen@...ux.intel.com,
torvalds@...ux-foundation.org, walken@...gle.com, x86@...nel.org
Subject: Re: [PATCH v11 0/4] Introducing a queue read/write lock implementation
How about getting rid of that TICKET_MSB mess and doing something like:
#define TICKET_MASK 0xFFFF
static inline void ticket_spin_unlock(atomic_t *tickets)
{
u32 t = *tickets;
smp_mb__before_atomic_inc();
/* Increment the low 16 bits without affecting the upper. */
if (unlikely((~t & TICKET_MASK) == 0))
atomic_add(-(atomic_t)TICKET_MASK, tickets);
else
atomic_inc(tickets);
}
That also allows up to 2^16 waiters, up from 2^15.
(Minus one on both cases, if you want to be fussy.)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists