On Tue, 6 Mar 2018, Andrey Konovalov wrote: > >> + u32 state = this_cpu_read(prng_state); > >> + > >> + state = 1664525 * state + 1013904223; > >> + this_cpu_write(prng_state, state); > > > > Have you considered preemption here? Is the assumption that it happens > > sufficiently rarely that cross-contaminating the prng state isn't a > > problem? > > Hi Mark! > > Yes, I have. If a preemption happens between this_cpu_read and > this_cpu_write, the only side effect is that we'll give a few > allocated in different contexts objects the same tag. Sine KHWASAN is > meant to be used a probabilistic bug-detection debug feature, this > doesn't seem to have serious negative impact. > > I'll add a comment about this though. You could use this_cpu_cmpxchg here to make it a bit better but it probably does not matter. -- 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>