Hi!
> >Thanks. The functions are not performance sensitive, so
> >atomic_t is ok. Here is the new patch.
> >
>
> The only reason atomic_t will help in this case is because it uses volatile for internal counter, as it does nothing additional on atomic_read(). I don't get what is the issue with using volatile directly. May be I am missing something. Pavel can you elaborate please.
>
Look at atomic_t again. It is definitely not "just volatile",
definitely not on non-i386 architectures.
> The code here is doing something like this
>
> While (variable != specific_value)
> cpu_relax();
So either do
while (variable != value)
mb();
or better use atomic_t.
> So, making variable atomic or declaring variable as volatile should have the same impact here. Note there is only one CPU setting this variable and rest of the CPUs just read it.
>
> If volatile is not good, probably we need to find something other than atomic as well.
>
atomic_t works, is used across the kernel, and works on all
architectures. volatile int does not. Do not use it.
Pavel
--
Thanks, Sharp!
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]