why does the 'break_lock' field of spinlock exist for preemptive kernel?

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

 



Hi,

    I am reading the source code of spinlock and have a question about
it. The spinlock is defined as:

typedef struct {
     volatile unsigned int slock;
#ifdef CONFIG_PREEMPT
     unsigned int break_lock;
#endif
} spinlock_t;

When 'break_lock' is one, it indicates that there are other tasks
waiting the spinlock. If so, these tasks should be running on other
CPUs. In other words, there are definitely no other tasks waiting the
lock, which are on the same CPU on which the spinlock owner is runing,
because the owner has disabled the kernel preemption. That is, there
are no other local tasks which can set 'break_lock' to 1. Therefore, I
think whether or not 'break_lock' is defined has nothing to do with
CONFIG_PREEMPT. May be a misunderstanding. Any explanation?

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux