Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-28 Thread Mike Galbraith
On Tue, 2015-04-28 at 12:19 +0200, Peter Zijlstra wrote: > On Sun, Apr 26, 2015 at 11:58:51AM -0400, Steven Rostedt wrote: > > I think what Xunlei is trying to say, is that we don't currently keep > > FIFO when preemption or migration is involved. If a task is currently > > running, strict FIFO

Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-28 Thread Peter Zijlstra
On Sun, Apr 26, 2015 at 11:58:51AM -0400, Steven Rostedt wrote: > I think what Xunlei is trying to say, is that we don't currently keep > FIFO when preemption or migration is involved. If a task is currently > running, strict FIFO denotes that it should run ahead of all other > tasks queued at its

Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-28 Thread Mike Galbraith
On Tue, 2015-04-28 at 12:19 +0200, Peter Zijlstra wrote: On Sun, Apr 26, 2015 at 11:58:51AM -0400, Steven Rostedt wrote: I think what Xunlei is trying to say, is that we don't currently keep FIFO when preemption or migration is involved. If a task is currently running, strict FIFO denotes

Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-28 Thread Peter Zijlstra
On Sun, Apr 26, 2015 at 11:58:51AM -0400, Steven Rostedt wrote: I think what Xunlei is trying to say, is that we don't currently keep FIFO when preemption or migration is involved. If a task is currently running, strict FIFO denotes that it should run ahead of all other tasks queued at its

Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-26 Thread Steven Rostedt
On Sun, 26 Apr 2015 17:52:16 +0800 pang.xun...@zte.com.cn wrote: > The problem I tried to describe here is: > > We know, there are two main queues each cpu for RT scheduler: > "run queue" and "pushable queue". > > For RT tasks, the scheduler uses "plist" to manage the pushable queue, > so

Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-26 Thread Steven Rostedt
On Sun, 26 Apr 2015 17:52:16 +0800 pang.xun...@zte.com.cn wrote: The problem I tried to describe here is: We know, there are two main queues each cpu for RT scheduler: run queue and pushable queue. For RT tasks, the scheduler uses plist to manage the pushable queue, so when there are

Re: Re: Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-25 Thread Peter Zijlstra
On Sat, Apr 25, 2015 at 10:47:00PM +0800, pang.xun...@zte.com.cn wrote: > We want to do the operation in put_prev_task_rt(), and > put_prev_task_rt() has many call sites. > So I've still no clue wtf you're trying to do, there's words in your changelog but none of them seem to describe the

Re: Re: Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-25 Thread Peter Zijlstra
On Sat, Apr 25, 2015 at 10:47:00PM +0800, pang.xun...@zte.com.cn wrote: We want to do the operation in put_prev_task_rt(), and put_prev_task_rt() has many call sites. So I've still no clue wtf you're trying to do, there's words in your changelog but none of them seem to describe the actual

Re: Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-24 Thread Peter Zijlstra
On Thu, Apr 23, 2015 at 02:53:27PM +0800, pang.xun...@zte.com.cn wrote: > But for yield() or RR scheduling when running out of time slice, > I think this would be still inappropriate, am I missing something? Those two have explicit hooks you can use to do the right queueing with. Look at

Re: Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-24 Thread Peter Zijlstra
On Thu, Apr 23, 2015 at 02:53:27PM +0800, pang.xun...@zte.com.cn wrote: But for yield() or RR scheduling when running out of time slice, I think this would be still inappropriate, am I missing something? Those two have explicit hooks you can use to do the right queueing with. Look at

Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-23 Thread Steven Rostedt
On Thu, 23 Apr 2015 14:53:27 +0800 pang.xun...@zte.com.cn wrote: > > Why not use Peter's idea of instead of checking PREEMPT_ACTIVE, just > > check if the task is on the runqueue or not. If it scheduled out, it > > would take itself off the runqueue, if it was preempted by anything, it > > would

Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-23 Thread Steven Rostedt
On Thu, 23 Apr 2015 14:53:27 +0800 pang.xun...@zte.com.cn wrote: Why not use Peter's idea of instead of checking PREEMPT_ACTIVE, just check if the task is on the runqueue or not. If it scheduled out, it would take itself off the runqueue, if it was preempted by anything, it would still

Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-22 Thread Steven Rostedt
On Thu, 23 Apr 2015 09:35:12 +0800 pang.xun...@zte.com.cn wrote: > Hi Steve, Peter, > > Steven Rostedt wrote 2015-04-21 AM 01:48:03: > > On Mon, 20 Apr 2015 19:20:48 +0200 > > Peter Zijlstra wrote: > > > > > > > + */ > > > > > + if (preempt_count() & PREEMPT_ACTIVE) > > > > > +

Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-22 Thread Steven Rostedt
On Thu, 23 Apr 2015 09:35:12 +0800 pang.xun...@zte.com.cn wrote: Hi Steve, Peter, Steven Rostedt rost...@goodmis.org wrote 2015-04-21 AM 01:48:03: On Mon, 20 Apr 2015 19:20:48 +0200 Peter Zijlstra pet...@infradead.org wrote: + */ + if (preempt_count()

Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-21 Thread Steven Rostedt
On Tue, 21 Apr 2015 01:45:50 +0200 Peter Zijlstra wrote: > Please don't try and be clever there :-) Task state can be misleading, > you might get a wakeup before you're running again, in which case you > never went to sleep. OK, point taken. > > Please use task_on_rq_queued(p) like all other

Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-21 Thread Steven Rostedt
On Tue, 21 Apr 2015 01:45:50 +0200 Peter Zijlstra pet...@infradead.org wrote: Please don't try and be clever there :-) Task state can be misleading, you might get a wakeup before you're running again, in which case you never went to sleep. OK, point taken. Please use task_on_rq_queued(p)

Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-20 Thread Peter Zijlstra
On Mon, Apr 20, 2015 at 01:48:03PM -0400, Steven Rostedt wrote: > On Mon, 20 Apr 2015 19:20:48 +0200 > Peter Zijlstra wrote: > > > > > +*/ > > > > + if (preempt_count() & PREEMPT_ACTIVE) > > > > + enqueue_pushable_task_preempted(rq, p); > > > >

Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-20 Thread Steven Rostedt
On Mon, 20 Apr 2015 19:20:48 +0200 Peter Zijlstra wrote: > > > + */ > > > + if (preempt_count() & PREEMPT_ACTIVE) > > > + enqueue_pushable_task_preempted(rq, p); > > > + else > > > + enqueue_pushable_task(rq, p); > > > + } > > > } > >

Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-20 Thread Peter Zijlstra
On Mon, Apr 20, 2015 at 10:52:28AM -0400, Steven Rostedt wrote: > On Mon, 20 Apr 2015 16:22:47 +0800 > Xunlei Pang wrote: > > > static inline void enqueue_pushable_task(struct rq *rq, struct task_struct > > *p) > > { > > } > > @@ -1506,8 +1526,21 @@ static void put_prev_task_rt(struct rq

Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-20 Thread Steven Rostedt
On Mon, 20 Apr 2015 16:22:47 +0800 Xunlei Pang wrote: > static inline void enqueue_pushable_task(struct rq *rq, struct task_struct > *p) > { > } > @@ -1506,8 +1526,21 @@ static void put_prev_task_rt(struct rq *rq, struct > task_struct *p) >* The previous task needs to be made

[PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-20 Thread Xunlei Pang
From: Xunlei Pang Currently, SMP RT scheduler has some trouble in dealing with equal prio cases. For example, in check_preempt_equal_prio(): When RT1(current task) gets preempted by RT2, if there is a migratable RT3 with same prio, RT3 will be pushed away instead of RT1 afterwards, because RT1

Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-20 Thread Peter Zijlstra
On Mon, Apr 20, 2015 at 01:48:03PM -0400, Steven Rostedt wrote: On Mon, 20 Apr 2015 19:20:48 +0200 Peter Zijlstra pet...@infradead.org wrote: +*/ + if (preempt_count() PREEMPT_ACTIVE) + enqueue_pushable_task_preempted(rq, p);

[PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-20 Thread Xunlei Pang
From: Xunlei Pang pang.xun...@linaro.org Currently, SMP RT scheduler has some trouble in dealing with equal prio cases. For example, in check_preempt_equal_prio(): When RT1(current task) gets preempted by RT2, if there is a migratable RT3 with same prio, RT3 will be pushed away instead of RT1

Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-20 Thread Steven Rostedt
On Mon, 20 Apr 2015 16:22:47 +0800 Xunlei Pang xlp...@126.com wrote: static inline void enqueue_pushable_task(struct rq *rq, struct task_struct *p) { } @@ -1506,8 +1526,21 @@ static void put_prev_task_rt(struct rq *rq, struct task_struct *p) * The previous task needs to be made

Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-20 Thread Steven Rostedt
On Mon, 20 Apr 2015 19:20:48 +0200 Peter Zijlstra pet...@infradead.org wrote: + */ + if (preempt_count() PREEMPT_ACTIVE) + enqueue_pushable_task_preempted(rq, p); + else + enqueue_pushable_task(rq, p); + } } This

Re: [PATCH v6 2/3] sched/rt: Fix wrong SMP scheduler behavior for equal prio cases

2015-04-20 Thread Peter Zijlstra
On Mon, Apr 20, 2015 at 10:52:28AM -0400, Steven Rostedt wrote: On Mon, 20 Apr 2015 16:22:47 +0800 Xunlei Pang xlp...@126.com wrote: static inline void enqueue_pushable_task(struct rq *rq, struct task_struct *p) { } @@ -1506,8 +1526,21 @@ static void put_prev_task_rt(struct rq