[<prev] [next>] [day] [month] [year] [list]
Message-ID: <D269C7CBDF116A48982D4DC51F111BE30213AF1C@nsezhpmail01.india.ipolicynet.com>
Date: Fri, 14 Jul 2006 17:01:59 +0530
From: "Hannibal B" <bhannibal@...licynetworks.com>
To: "Jesper Juhl" <jesper.juhl@...il.com>, <wyb@...sec.com.cn>
Cc: <linux-kernel@...r.kernel.org>
Subject: RE: SMP share data declaration
Spinlocks would be the one to protect the variable and synchronies
between CPU, But it's a busy waiting mechanism(just a word of caution).
Regards,
Hannibal
-----Original Message-----
From: Jesper Juhl [mailto:jesper.juhl@...il.com]
Sent: Friday, July 14, 2006 2:18 PM
To: wyb@...sec.com.cn
Cc: linux-kernel@...r.kernel.org
Subject: Re: SMP share data declaration
On 14/07/06, wyb@...sec.com.cn <wyb@...sec.com.cn> wrote:
> I know that an integer variable should be declared volatile to share
between
> CPUs.
NO. volatile won't protect you sufficiently.
Use spinlocks, mutexes, semaphores, barriers and the like to protect
variables from concurrent access. Using volatile for this is a BUG and
it won't work correctly.
--
Jesper Juhl <jesper.juhl@...il.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel"
in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists