Re: Simple Flag on SMP

From: Frank A. Uepping (null.0.fau_at_spamgourmet.com)
Date: 11/05/03


Date: Wed, 05 Nov 2003 20:46:21 +0100

Neil Horman wrote:

> Frank A. Uepping wrote:
>> Neil Horman wrote:
>>
>>
>>>Tuukka Toivonen wrote:
>>>
>>>>In article <bo8f6c$1u2$1@stan.redhat.com>, Neil Horman wrote:
>>>>
>>>>
>>>>>>volatile is to weak for SMP, is that true?
>>>>>>What are other alternatives to volatile?
>>>>>
>>>>>not at all portable. If you want to guarantee it, you need to use
>>>>>mutexes or semaphores to protect your data.
>>>>
>>>>
>>>>Strange that I haven't noticed anyone yet mentioning functions
>>>>in <asm/atomic.h>, such as
>>>> * atomic_sub - subtract the atomic variable
>>>> * atomic_add - add integer to atomic variable
>>>>etc...
>>>
>>>Those'll work perfectly well too. ;)
>>>Neil
>>>
>>
>> Has the atomic_t the effect of a memory barrier()?
>> I mean, does an atomic_t ensures that a modification of data gets
>> immediately visible to the CPUs?
>>
>> /FAU
>>
>>
> It has to. Otherwise atomic variable would be broken on SMP systems.
Consequently, spinlocks and other synchronizing mechanisms behave so too.

/FAU



Relevant Pages

  • [patch 4/4] x86: spinlock.h merge
    ... * Your basic SMP spinlocks, allowing only a single CPU anywhere ... * Simple spin lock operations. ... +#error spinlock supports a maximum of 256 CPUs ...
    (Linux-Kernel)
  • HT apparently not detected properly on 2.4.23
    ... The same config with 2.4.23 only shows 2 cpus, ... properly detected on several other SMP systems I have at work (compaq ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Blade vs Superdome
    ... Do such blades start to approach the performance of the interconnects ... between CPUs in Superdome systems? ... on large SMP systems. ...
    (comp.os.vms)
  • Re: New filesystem for Linux
    ... Does one Linux kernel run on system with 1024 cpus? ... I guess it must fry ... spinlocks... ...
    (Linux-Kernel)
  • SMP & memory question
    ... Question regarding how SMP systems allocate memory... ... If there's a server with dual CPUs and 6GB of RAM total, ... Is it split 50/50 between the CPUs with each getting 3GB of RAM? ...
    (comp.os.linux.hardware)