On Mon, Jul 11, 2016 at 09:06:58AM -0700, Linus Torvalds wrote: > On Jul 11, 2016 7:55 AM, "Andy Lutomirski" <[1]luto@xxxxxxxxxxxxxx> wrote: > > > > How do you intend to find 'current' to get to the preempt count > > without first disabling preemption? > > Actually, that is the classic case of "not a problem". > > The thing is, it doesn't matter if you schedule away while looking up > current or the preempt count - because both values are idempotent wet > scheduling. > > So until you do the wire that actually disables preemption you can > schedule away as much as you want, and after that write you no longer > will. I was assuming a percpu pointer to current (or preempt count). The percpu offset might be stale at the point you try to dereference that, even though current itself hasn't changed, and you may access the wrong CPU's value. > This is different wrt a per-cpu area - which is clearly not idempotent wrt > scheduling. > > The reason per-cpu works on x86 is that we have an atomic rmw operation > that is *also* atomic wrt the CPU lookup (thanks to the segment base) Sure, understood. Mark. -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html