Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-26 Thread Steven Rostedt
On Thu, 26 Feb 2015 14:47:54 +0100 Peter Zijlstra wrote: > > Thinking about this more, is it because a wmb just forces the CPU to > > write everything before this before it writes anything after it. That > > is, the writes themselves can happen at a much later time. Does a plain > > mb() work

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-26 Thread Peter Zijlstra
On Thu, Feb 26, 2015 at 07:43:01AM -0500, Steven Rostedt wrote: > On Thu, 26 Feb 2015 08:45:59 +0100 > Peter Zijlstra wrote: > > > On Wed, Feb 25, 2015 at 12:50:15PM -0500, Steven Rostedt wrote: > > > It can't be used for state? > > > > > > If one CPU writes "zero", and the other CPU wants to

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-26 Thread Steven Rostedt
On Thu, 26 Feb 2015 08:49:07 +0100 Peter Zijlstra wrote: > Yes, notice that we don't start iterating at the beginning; this in on > purpose. If we start iterating at the beginning, _every_ cpu will again > pile up on the first one. > > By starting at the current cpu, each cpu will start

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-26 Thread Steven Rostedt
On Thu, 26 Feb 2015 08:45:59 +0100 Peter Zijlstra wrote: > On Wed, Feb 25, 2015 at 12:50:15PM -0500, Steven Rostedt wrote: > > It can't be used for state? > > > > If one CPU writes "zero", and the other CPU wants to decide if the > > system is in the state to do something, isn't a rmb() fine to

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-26 Thread Steven Rostedt
On Thu, 26 Feb 2015 08:49:07 +0100 Peter Zijlstra pet...@infradead.org wrote: Yes, notice that we don't start iterating at the beginning; this in on purpose. If we start iterating at the beginning, _every_ cpu will again pile up on the first one. By starting at the current cpu, each cpu

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-26 Thread Steven Rostedt
On Thu, 26 Feb 2015 14:47:54 +0100 Peter Zijlstra pet...@infradead.org wrote: Thinking about this more, is it because a wmb just forces the CPU to write everything before this before it writes anything after it. That is, the writes themselves can happen at a much later time. Does a plain

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-26 Thread Steven Rostedt
On Thu, 26 Feb 2015 08:45:59 +0100 Peter Zijlstra pet...@infradead.org wrote: On Wed, Feb 25, 2015 at 12:50:15PM -0500, Steven Rostedt wrote: It can't be used for state? If one CPU writes zero, and the other CPU wants to decide if the system is in the state to do something, isn't a

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-26 Thread Peter Zijlstra
On Thu, Feb 26, 2015 at 07:43:01AM -0500, Steven Rostedt wrote: On Thu, 26 Feb 2015 08:45:59 +0100 Peter Zijlstra pet...@infradead.org wrote: On Wed, Feb 25, 2015 at 12:50:15PM -0500, Steven Rostedt wrote: It can't be used for state? If one CPU writes zero, and the other CPU wants

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-25 Thread Peter Zijlstra
On Wed, Feb 25, 2015 at 12:50:15PM -0500, Steven Rostedt wrote: > > Well, the problem with it is one of collisions. So the 'easy' solution I > > proposed would be something like: > > > > int ips_next(struct ipi_pull_struct *ips) > > { > > int cpu = ips->src_cpu; > > cpu =

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-25 Thread Peter Zijlstra
On Wed, Feb 25, 2015 at 12:50:15PM -0500, Steven Rostedt wrote: > It can't be used for state? > > If one CPU writes "zero", and the other CPU wants to decide if the > system is in the state to do something, isn't a rmb() fine to use? > > > CPU 1: > > x = 0; > /* Tell other CPUs

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-25 Thread Steven Rostedt
On Wed, 25 Feb 2015 18:11:10 +0100 Peter Zijlstra wrote: > > > Actually, this is a speed up, but if exiting a irq handler is also a > > full barrier, then it is not needed. > > Barrieres are _NEVER_ about speedups, they're either required or not. "speed up" was a wrong word. "correct state"

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-25 Thread Peter Zijlstra
On Wed, Feb 25, 2015 at 06:11:10PM +0100, Peter Zijlstra wrote: > > #define IPS_BUSY 0x01 > #define IPS_LOOPED0x02 > > struct ipi_pull_struct { > struct irq_work work; > raw_spinlock_t lock; > int flags; > int dst_cpu;/* CPU that issued this search */ >

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-25 Thread Peter Zijlstra
On Wed, Feb 25, 2015 at 10:51:16AM -0500, Steven Rostedt wrote: > > > +static void try_to_push_tasks(void *arg) > > > +{ > > > + struct rt_rq *rt_rq = arg; > > > + struct rq *rq, *next_rq; > > > + int next_cpu = -1; > > > + int next_prio = MAX_PRIO + 1; > > > + int this_prio; > > > + int src_prio;

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-25 Thread Steven Rostedt
On Wed, 25 Feb 2015 11:35:35 +0100 Peter Zijlstra wrote: > On Tue, Feb 24, 2015 at 01:39:46PM -0500, Steven Rostedt wrote: > > Index: linux-rt.git/kernel/sched/rt.c > > === > > --- linux-rt.git.orig/kernel/sched/rt.c 2015-02-24

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-25 Thread Peter Zijlstra
On Tue, Feb 24, 2015 at 01:39:46PM -0500, Steven Rostedt wrote: > Index: linux-rt.git/kernel/sched/rt.c > === > --- linux-rt.git.orig/kernel/sched/rt.c 2015-02-24 10:44:08.798785452 > -0500 > +++ linux-rt.git/kernel/sched/rt.c

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-25 Thread Steven Rostedt
On Wed, 25 Feb 2015 11:35:35 +0100 Peter Zijlstra pet...@infradead.org wrote: On Tue, Feb 24, 2015 at 01:39:46PM -0500, Steven Rostedt wrote: Index: linux-rt.git/kernel/sched/rt.c === --- linux-rt.git.orig/kernel/sched/rt.c

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-25 Thread Steven Rostedt
On Wed, 25 Feb 2015 18:11:10 +0100 Peter Zijlstra pet...@infradead.org wrote: Actually, this is a speed up, but if exiting a irq handler is also a full barrier, then it is not needed. Barrieres are _NEVER_ about speedups, they're either required or not. speed up was a wrong word.

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-25 Thread Peter Zijlstra
On Wed, Feb 25, 2015 at 10:51:16AM -0500, Steven Rostedt wrote: +static void try_to_push_tasks(void *arg) +{ + struct rt_rq *rt_rq = arg; + struct rq *rq, *next_rq; + int next_cpu = -1; + int next_prio = MAX_PRIO + 1; + int this_prio; + int src_prio; + int prio; + int

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-25 Thread Peter Zijlstra
On Wed, Feb 25, 2015 at 06:11:10PM +0100, Peter Zijlstra wrote: #define IPS_BUSY 0x01 #define IPS_LOOPED0x02 struct ipi_pull_struct { struct irq_work work; raw_spinlock_t lock; int flags; int dst_cpu;/* CPU that issued this search */ int

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-25 Thread Peter Zijlstra
On Wed, Feb 25, 2015 at 12:50:15PM -0500, Steven Rostedt wrote: It can't be used for state? If one CPU writes zero, and the other CPU wants to decide if the system is in the state to do something, isn't a rmb() fine to use? CPU 1: x = 0; /* Tell other CPUs they can now do

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-25 Thread Peter Zijlstra
On Wed, Feb 25, 2015 at 12:50:15PM -0500, Steven Rostedt wrote: Well, the problem with it is one of collisions. So the 'easy' solution I proposed would be something like: int ips_next(struct ipi_pull_struct *ips) { int cpu = ips-src_cpu; cpu = cpumask_next(cpu, rto_mask);

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-25 Thread Peter Zijlstra
On Tue, Feb 24, 2015 at 01:39:46PM -0500, Steven Rostedt wrote: Index: linux-rt.git/kernel/sched/rt.c === --- linux-rt.git.orig/kernel/sched/rt.c 2015-02-24 10:44:08.798785452 -0500 +++ linux-rt.git/kernel/sched/rt.c

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-24 Thread Hillf Danton
> +static void try_to_push_tasks(void *arg) > +{ > + struct rt_rq *rt_rq = arg; > + struct rq *rq, *next_rq; > + int next_cpu = -1; > + int next_prio = MAX_PRIO + 1; > + int this_prio; > + int src_prio; > + int prio; > + int this_cpu; > + int success; > +

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-24 Thread Steven Rostedt
On Tue, 24 Feb 2015 13:39:46 -0500 Steven Rostedt wrote: > @@ -1775,6 +1946,15 @@ static int pull_rt_task(struct rq *this_ >*/ > smp_rmb(); > > + /* Use local just in case a feature is switched in the middle of this */ > + if ((use_ipi = sched_feat(RT_PUSH_IPI))) { > +

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-24 Thread Steven Rostedt
On Tue, 24 Feb 2015 13:39:46 -0500 Steven Rostedt wrote: > +static void tell_cpu_to_push(int cpu, struct rq *rq, int prio) > +{ > + /* We should never be here if the IPI is already out. */ > + BUG_ON(rq->rt.push_csd_pending); > + > + rq->rt.push_csd_pending = 1; > +

[RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-24 Thread Steven Rostedt
When debugging the latencies on a 40 core box, where we hit 300 to 500 microsecond latencies, I found there was a huge contention on the runqueue locks. Investigating it further, running ftrace, I found that it was due to the pulling of RT tasks. The test that was run was the following:

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-24 Thread Steven Rostedt
On Tue, 24 Feb 2015 13:39:46 -0500 Steven Rostedt rost...@goodmis.org wrote: @@ -1775,6 +1946,15 @@ static int pull_rt_task(struct rq *this_ */ smp_rmb(); + /* Use local just in case a feature is switched in the middle of this */ + if ((use_ipi =

[RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-24 Thread Steven Rostedt
When debugging the latencies on a 40 core box, where we hit 300 to 500 microsecond latencies, I found there was a huge contention on the runqueue locks. Investigating it further, running ftrace, I found that it was due to the pulling of RT tasks. The test that was run was the following:

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-24 Thread Steven Rostedt
On Tue, 24 Feb 2015 13:39:46 -0500 Steven Rostedt rost...@goodmis.org wrote: +static void tell_cpu_to_push(int cpu, struct rq *rq, int prio) +{ + /* We should never be here if the IPI is already out. */ + BUG_ON(rq-rt.push_csd_pending); + + rq-rt.push_csd_pending = 1; +

Re: [RFC][PATCH v2] sched/rt: Use IPI to trigger RT task push migration instead of pulling

2015-02-24 Thread Hillf Danton
+static void try_to_push_tasks(void *arg) +{ + struct rt_rq *rt_rq = arg; + struct rq *rq, *next_rq; + int next_cpu = -1; + int next_prio = MAX_PRIO + 1; + int this_prio; + int src_prio; + int prio; + int this_cpu; + int success; + int cpu; + +