On Thu, Oct 07, 2021 at 11:42:24AM +0200, Sebastian Andrzej Siewior wrote: > On 2021-10-05 11:17:16 [-0700], Eric Biggers wrote: > > Hi Sebastian, > Hi, > > > The comment above the definition of migrate_disable() in include/linux/preempt.h > > claims that it is a temporary workaround. > > It claims that, yes. I think this is due to the scheduler's limitation > and should not encourage to use this over long sections. > > > Is there a better way to do this that should be used instead? > > An alternative might be to move the whole test into a kworker which is > bound to a specific CPU. So even without disabling preemption/ migration > the per-CPU pointer would remain stable. > It's only individual test cases that need to use the SIMD disabled flag, not the whole test. An algorithm test could involve 100 test cases, any subset of which use the SIMD disabled flag and the others don't. So the assumption is that this can be a relatively fine-grained knob. Executing different individual test cases on different threads sounds painful. Your simple change to use migrate_disable() looks much better, but I'm not sure how to reconcile that with the claim that migrate_disable() is a temporary workaround. - Eric