On Wed, 21 Nov 2018, Andi Kleen wrote:

> > +            * This could be optimized by keeping track of the last
> > +            * user task per cpu and avoiding the barrier when the task
> > +            * is immediately scheduled back and the thread inbetween
> > +            * was a kernel thread. It's dubious whether that'd be
> > +            * worth the extra load/store and conditional operations.
> > +            * Keep it optimized for the common case where the TIF bit
> > +            * is not set.
> > +            */
> 
> The optimization was there before and you removed it?
> 
> It's quite important for switching to idle and back. With your variant short 
> IOs
> that do short idle waits will be badly impacted. 

The question is what scenario to optimize for.

Either you penalize everybody in the default prctl+seccomp setup 
(irrespective of it's TIF flag value), as you have the extra overhead on 
each and every switch_to() (to check exactly for this back-to-back 
scheduling), or you penalize only those tasks that are penalized anyway by 
the IBPB flush.

I think the latter (which is what this patch implements) makes more sense. 

Thanks,

-- 
Jiri Kosina
SUSE Labs

Reply via email to