Re: [PATCH v11 0/4] Introducing a queue read/write lock implementation

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

 



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-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux