Jeremy Fitzhardinge writes: > Or do you mean that if you have: > > preempt_disable(); > use_my_percpu++; > preempt_enable(); > // switch cpus > preempt_disable(); > use_my_percpu++; > preempt_enable(); > > then it will still use the old pointer to use_my_percpu?
Yes. It can, and sometimes does. There's no way (that I know of) to tell gcc "all my __thread variables might have moved to a different address". > In principle gcc could CSE the value of smp_processor_id() across a cpu > change in the same way. There it's easier to make gcc do what we want, because we can use a barrier or a volatile. The difference is that smp_processor_id() is ultimately the value of something, not the address of something. We can tell gcc "values might have changed" but have no way to say "addresses might have changed". Paul. - 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/