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

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

 



* Heiko Carstens <heiko.carstens@xxxxxxxxxx> wrote:

> -	spin_lock(&new_base->lock);
> -	spin_lock(&old_base->lock);
> +	/*
> +	 * If we take a lock from a different cpu, make sure we have always
> +	 * the same locking order. That is the lock that belongs to the cpu
> +	 * with the lowest number is taken first.
> +	 */
> +	lock1 = smp_processor_id() < cpu ? &new_base->lock : &old_base->lock;
> +	lock2 = smp_processor_id() < cpu ? &old_base->lock : &new_base->lock;
> +	spin_lock(lock1);
> +	spin_lock(lock2);

looks good to me. Wouldnt this be cleaner via double_lock_timer() - 
similar to how double_rq_lock() works in kernel/sched.c - instead of 
open-coding it?

	Ingo
-
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