Re: synchronisation question

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

 





On 8/30/05, Jan Hudec <bulb@xxxxxx> wrote:
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

Yes, I know that. I was just giving the difference between  spin_locks_irqsave() on SMP and  local_isq_disable() on UP machines. I agree to you that we should write our code keeping in mind the SMP senerio as preemption even converts the UP machine to behave as SMP machine (I mean the synchronization problems are same)

(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).

Can you elaborate on this more, I could not get the meaning of it.

regards,
-Gaurav

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


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDFEvURel1vVwhjGURAvywAKCEVlBSpCMZZw7jPd4WnwGQI2BpkgCg4HUv
JEytEuEqS4AlA1w6OMCyLSo=
=Qmob
-----END PGP 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