On Mon, Jun 5, 2017 at 3:40 PM, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > On Mon, Jun 5, 2017 at 3:36 PM, Andy Lutomirski <luto@xxxxxxxxxx> wrote: >> We used to switch the LDT if the prev and next mms' LDTs didn't >> match. > > I think the "LDT didn't match" was really just a simpler and more > efficient way to say "they weren't both NULL". Once we go fully lazy (later in this series), though, I'd start worrying that the optimization would be wrong: 1 Load ldt 0x1234 2. Become lazy 3. LDT changes twice from a remote cpu and the second change reuses the pointer 0x1234. 4. We go unlazy, prev == next, but LDTR is wrong. This isn't a bug in current kernels because step 3 will force a leave_mm(). > > I think you actually broke that optimization, and it now does *two* > tests instead of just one. I haven't looked at the generated code, but shouldn't it be just orq; jnz? --Andy -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>