Re: Why a “barrier()” is enough for disabling or enabling the preemption?

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

 



> #define preempt_disable() barrier()
> ......
> #define preempt_enable() barrier()

  Let me try answering this with a limited knowledge I have about barriers.
barrier() essentially was added so that compiler reordering does not happen.

  In the code above, since the compiler does not know/understand the
specialty of preempt_[enable/disable], the compiler might decide to change
the ordering.

 In this case, where the code is disabling/enabling preemption, barrier() tells
the compiler that it can't move stuff around.

 I hope this helps.

- Doug

_______________________________________________
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