Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1313081

Re: [PATCH] sched: Fix PI handling vs sched_setscheduler()

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH] sched: Fix PI handling vs sched_setscheduler()
Date 2016-01-20 11:30 +0100
Message-ID <qSYbw-51L-3@gated-at.bofh.it> (permalink)
References <qSCun-6ZJ-19@gated-at.bofh.it> <qSXSa-4UA-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Jan 20, 2016 at 10:08:39AM +0000, Juri Lelli wrote:
> Hi,
> 
> On 19/01/16 12:18, Peter Zijlstra wrote:
> 
> [...]
> 
> > @@ -4097,15 +4099,14 @@ static int __sched_setscheduler(struct t
> >  	if (running)
> >  		p->sched_class->set_curr_task(rq);
> >  	if (queued) {
> > -		int enqueue_flags = ENQUEUE_RESTORE;
> >  		/*
> >  		 * We enqueue to tail when the priority of a task is
> >  		 * increased (user space view).
> >  		 */
> > -		if (oldprio <= p->prio)
> > -			enqueue_flags |= ENQUEUE_HEAD;
> > +		if (oldprio < p->prio)
> > +			queue_flags |= ENQUEUE_HEAD;
> 
> Was this condition broken before or it needs to be changed now with this
> patch?

I could not see how we could get there before, seeing how the == case is
handled above.

> > --- a/kernel/sched/sched.h
> > +++ b/kernel/sched/sched.h
> > @@ -1130,18 +1130,35 @@ static inline void finish_lock_switch(st
> >  extern const int sched_prio_to_weight[40];
> >  extern const u32 sched_prio_to_wmult[40];
> >  
> > +/*
> > + * {de,en}queue flags:
> > + *
> > + * SAVE/RESTORE - an otherwise spurious dequeue/enqueue, done to ensure tasks
> > + *                are in a known state which allows modification. Such pairs
> > + *                should preserve as much state as possible.
> > + *
> > + * MOVE - paired with SAVE/RESTORE, explicitly does not preserve the location
> > + *        in the runqueue.
> > + *
> > + * ENQUEUE_HEAD - place at front of runqueue (tail if not specificed)
> > + *
> > + */
> 
> Do we want to document all the flags while we are at it? :)

Probably.. does the below work? I think I bailed on replenish because I
could not come up with a coherent short description, does the below make
any sense?


--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1140,7 +1140,9 @@ extern const u32 sched_prio_to_wmult[40]
  * MOVE - paired with SAVE/RESTORE, explicitly does not preserve the location
  *        in the runqueue.
  *
- * ENQUEUE_HEAD - place at front of runqueue (tail if not specificed)
+ * ENQUEUE_HEAD      - place at front of runqueue (tail if not specificed)
+ * ENQUEUE_REPLENISH - push the CBS slot forward
+ * ENQUEUE_WAKING    - sched_class::task_waking was called
  *
  */
 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] sched: Fix PI handling vs sched_setscheduler() Peter Zijlstra <peterz@infradead.org> - 2016-01-19 12:20 +0100
  Re: [PATCH] sched: Fix PI handling vs sched_setscheduler() Juri Lelli <juri.lelli@arm.com> - 2016-01-20 11:10 +0100
    Re: [PATCH] sched: Fix PI handling vs sched_setscheduler() Peter Zijlstra <peterz@infradead.org> - 2016-01-20 11:30 +0100
      Re: [PATCH] sched: Fix PI handling vs sched_setscheduler() Juri Lelli <juri.lelli@arm.com> - 2016-01-20 11:40 +0100
        Re: [PATCH] sched: Fix PI handling vs sched_setscheduler() Peter Zijlstra <peterz@infradead.org> - 2016-01-20 12:20 +0100

csiph-web