Re: [patch] timer/hrtimer: take per cpu locks in sane order

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

 



On Fri, Mar 02, 2007 at 11:47:52PM +0100, Heiko Carstens wrote:
>  /*
> + * Locks two spinlocks l1 and l2.
> + * l1_first indicates if spinlock l1 should be taken first.
> + */
> +static inline void double_spin_lock(spinlock_t *l1, spinlock_t *l2,
> +				    bool l1_first)
> +	__acquires(l1)
> +	__acquires(l2)
> +{
> +	if (l1_first) {
> +		spin_lock(l1);
> +		spin_lock(l2);
> +	} else {
> +		spin_lock(l2);
> +		spin_lock(l1);
> +	}
> +}

Two observations:

- We probably don't want people using this for locks that aren't
  explicitly in the same level of the hierarchy. The name should
  somehow indicate that. Something like spin_lock_siblings()?

- And once we know that, we can internally impose a natural stable
  ordering on them based on their addresses, eliminating the third
  argument and the need to duplicate the ordering calculation.

-- 
Mathematics is the supreme nostalgia of our time.
-
To unsubscribe from this list: send the line "unsubscribe linux-s390" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux