Re: synchronisation question

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

 



On Mon, Aug 29, 2005 at 21:29:16 +0530, Gaurav Dhiman wrote:
> On 8/29/05, Aggarwal, Vikas (OFT) <Vikas.Aggarwal@xxxxxxxxxxxxxxx> wrote:
> For handling such situation where you manupulate the common data
> structure from both interrupt context and process context and that too
> on SMP machines, you use spin_lock_irqsave() and
> spin_unlock_irqrestore() functions.
> 
> If you have UP machine then using only cli() / local_irq_disable() and
> sti() / local_irq_enable() function will work, no need to use the
> spinlocks in that case.

You never have a UP machine. Because when you write the code, you don't know
with that options it will be compiled. So you must write it for SMP. The
primitives will degrade properly on UP. Ie. spin_lock_irqsave will actually
compile as local_irq_disable on UP.

Also note, that preempt patch makes UP equivalent to SMP in most respects,
with the rest hidden away in spinlocks and other primitives for most cases
(actually, there is at least one point where preempt is _worse_ than SMP --
ordering of set_current_state, waitqueue_add and schedule() worked on SMP,
but it does NOT work on preempt).

--
						 Jan 'Bulb' Hudec <bulb@xxxxxx>

Attachment: signature.asc
Description: Digital signature


[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