[SPAM]Re: [Bug] Race condition between CPU hotplug off flow and __sched_setscheduler()

Jing-Ting Wu jing-ting.wu at mediatek.com
Thu Jun 2 09:15:51 PDT 2022


Hi Peter


> > > How easy can you reproduce; does the below hack make it better?

The patch is helpful to the syndrome, passed stability test over 10
days so far. (as-is: < 48 hours failed)

Could you help to upstream this patch to linux kernel mainline?
Thank you.

> 
> > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > > index 95bac3b094b3..f18ee22b29bc 100644
> > > --- a/kernel/sched/core.c
> > > +++ b/kernel/sched/core.c
> > > @@ -4763,20 +4763,30 @@ struct callback_head
> > > balance_push_callback
> > > =
> > > {
> > >  	.func = (void (*)(struct callback_head *))balance_push,
> > >  };
> > >  
> > > -static inline struct callback_head
> > > *splice_balance_callbacks(struct
> > > rq *rq)
> > > +static inline struct callback_head *
> > > +__splice_balance_callbacks(struct rq *rq, bool foo)
> > >  {
> > >  	struct callback_head *head = rq->balance_callback;
> > >  
> > >  	lockdep_assert_rq_held(rq);
> > > -	if (head)
> > > -		rq->balance_callback = NULL;
> > > +	if (head) {
> > > +		if (foo && head == &balance_push_callback)
> > > +			head = NULL;
> > > +		else
> > > +			rq->balance_callback = NULL;
> > > +	}
> > >  
> > >  	return head;
> > >  }
> > >  
> > > +static inline struct callback_head
> > > *splice_balance_callbacks(struct
> > > rq *rq)
> > > +{
> > > +	return __splice_balance_callbacks(rq, true);
> > > +}
> > > +
> > >  static void __balance_callbacks(struct rq *rq)
> > >  {
> > > -	do_balance_callbacks(rq, splice_balance_callbacks(rq));
> > > +	do_balance_callbacks(rq, __splice_balance_callbacks(rq,
> > > false));
> > >  }
> > >  
> > >  static inline void balance_callbacks(struct rq *rq, struct
> > > callback_head *head)
> > > 


Best Regards,
Jing-Ting Wu
> 
> 




More information about the Linux-mediatek mailing list