Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Andy Lutomirski
On Tue, Jun 3, 2014 at 11:44 AM, Andy Lutomirski wrote: > On Tue, Jun 3, 2014 at 11:28 AM, Peter Zijlstra wrote: >> On Tue, Jun 03, 2014 at 07:00:18PM +0200, Peter Zijlstra wrote: >>> On Tue, Jun 03, 2014 at 09:52:22AM -0700, Andy Lutomirski wrote: >>> > > So you could cheat and set it in

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Andy Lutomirski
On Tue, Jun 3, 2014 at 11:28 AM, Peter Zijlstra wrote: > On Tue, Jun 03, 2014 at 07:00:18PM +0200, Peter Zijlstra wrote: >> On Tue, Jun 03, 2014 at 09:52:22AM -0700, Andy Lutomirski wrote: >> > > So you could cheat and set it in pick_next_task_idle() and clear in >> > > put_prev_task_idle(), that

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Peter Zijlstra
On Tue, Jun 03, 2014 at 07:00:18PM +0200, Peter Zijlstra wrote: > On Tue, Jun 03, 2014 at 09:52:22AM -0700, Andy Lutomirski wrote: > > > So you could cheat and set it in pick_next_task_idle() and clear in > > > put_prev_task_idle(), that way the entire idle loop, when running has it > > > set. > >

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Peter Zijlstra
On Tue, Jun 03, 2014 at 09:52:22AM -0700, Andy Lutomirski wrote: > > So you could cheat and set it in pick_next_task_idle() and clear in > > put_prev_task_idle(), that way the entire idle loop, when running has it > > set. > > > > Isn't that a little late for sched_ttwu_pending? I guess it could

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Andy Lutomirski
On Tue, Jun 3, 2014 at 9:19 AM, Peter Zijlstra wrote: > On Tue, Jun 03, 2014 at 09:05:03AM -0700, Andy Lutomirski wrote: >> On Tue, Jun 3, 2014 at 7:02 AM, Peter Zijlstra wrote: >> > On Tue, Jun 03, 2014 at 12:43:47PM +0200, Peter Zijlstra wrote: >> >> We need rq->curr, rq->idle 'sleeps' with

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Peter Zijlstra
On Tue, Jun 03, 2014 at 09:05:03AM -0700, Andy Lutomirski wrote: > On Tue, Jun 3, 2014 at 7:02 AM, Peter Zijlstra wrote: > > On Tue, Jun 03, 2014 at 12:43:47PM +0200, Peter Zijlstra wrote: > >> We need rq->curr, rq->idle 'sleeps' with polling set and nr clear, but > >> it obviously has no effect

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Andy Lutomirski
On Tue, Jun 3, 2014 at 7:02 AM, Peter Zijlstra wrote: > On Tue, Jun 03, 2014 at 12:43:47PM +0200, Peter Zijlstra wrote: >> We need rq->curr, rq->idle 'sleeps' with polling set and nr clear, but >> it obviously has no effect setting that if its not actually the current >> task. >> >> Touching

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Peter Zijlstra
On Tue, Jun 03, 2014 at 12:43:47PM +0200, Peter Zijlstra wrote: > We need rq->curr, rq->idle 'sleeps' with polling set and nr clear, but > it obviously has no effect setting that if its not actually the current > task. > > Touching rq->curr needs holding rcu_read_lock() though, to make sure the >

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Peter Zijlstra
On Mon, Jun 02, 2014 at 11:40:26PM -0700, Andy Lutomirski wrote: > You're testing polling on the task being woken, which cannot possibly > succeed: the only tasks that have any business polling are the idle > tasks. Something like this seems to help: > > static void ttwu_queue_remote(struct

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Peter Zijlstra
On Mon, Jun 02, 2014 at 11:40:26PM -0700, Andy Lutomirski wrote: > Bugs found so far: > > defined(SMP) should be defined(CONFIG_SMP) > > You're testing polling on the task being woken, which cannot possibly > succeed: the only tasks that have any business polling are the idle > tasks. Something

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Andy Lutomirski
On Wed, May 28, 2014 at 11:48 PM, Peter Zijlstra wrote: > On Wed, May 28, 2014 at 05:01:41PM -0700, Andy Lutomirski wrote: >> On Thu, May 22, 2014 at 6:09 AM, Peter Zijlstra wrote: >> > On Thu, May 22, 2014 at 02:58:18PM +0200, Peter Zijlstra wrote: >> >> --- >> >> diff --git

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Andy Lutomirski
On Wed, May 28, 2014 at 11:48 PM, Peter Zijlstra pet...@infradead.org wrote: On Wed, May 28, 2014 at 05:01:41PM -0700, Andy Lutomirski wrote: On Thu, May 22, 2014 at 6:09 AM, Peter Zijlstra pet...@infradead.org wrote: On Thu, May 22, 2014 at 02:58:18PM +0200, Peter Zijlstra wrote: --- diff

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Peter Zijlstra
On Mon, Jun 02, 2014 at 11:40:26PM -0700, Andy Lutomirski wrote: Bugs found so far: defined(SMP) should be defined(CONFIG_SMP) You're testing polling on the task being woken, which cannot possibly succeed: the only tasks that have any business polling are the idle tasks. Something like

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Peter Zijlstra
On Mon, Jun 02, 2014 at 11:40:26PM -0700, Andy Lutomirski wrote: You're testing polling on the task being woken, which cannot possibly succeed: the only tasks that have any business polling are the idle tasks. Something like this seems to help: static void ttwu_queue_remote(struct

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Peter Zijlstra
On Tue, Jun 03, 2014 at 12:43:47PM +0200, Peter Zijlstra wrote: We need rq-curr, rq-idle 'sleeps' with polling set and nr clear, but it obviously has no effect setting that if its not actually the current task. Touching rq-curr needs holding rcu_read_lock() though, to make sure the task

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Andy Lutomirski
On Tue, Jun 3, 2014 at 7:02 AM, Peter Zijlstra pet...@infradead.org wrote: On Tue, Jun 03, 2014 at 12:43:47PM +0200, Peter Zijlstra wrote: We need rq-curr, rq-idle 'sleeps' with polling set and nr clear, but it obviously has no effect setting that if its not actually the current task.

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Peter Zijlstra
On Tue, Jun 03, 2014 at 09:05:03AM -0700, Andy Lutomirski wrote: On Tue, Jun 3, 2014 at 7:02 AM, Peter Zijlstra pet...@infradead.org wrote: On Tue, Jun 03, 2014 at 12:43:47PM +0200, Peter Zijlstra wrote: We need rq-curr, rq-idle 'sleeps' with polling set and nr clear, but it obviously has

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Andy Lutomirski
On Tue, Jun 3, 2014 at 9:19 AM, Peter Zijlstra pet...@infradead.org wrote: On Tue, Jun 03, 2014 at 09:05:03AM -0700, Andy Lutomirski wrote: On Tue, Jun 3, 2014 at 7:02 AM, Peter Zijlstra pet...@infradead.org wrote: On Tue, Jun 03, 2014 at 12:43:47PM +0200, Peter Zijlstra wrote: We need

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Peter Zijlstra
On Tue, Jun 03, 2014 at 09:52:22AM -0700, Andy Lutomirski wrote: So you could cheat and set it in pick_next_task_idle() and clear in put_prev_task_idle(), that way the entire idle loop, when running has it set. Isn't that a little late for sched_ttwu_pending? I guess it could be okay,

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Peter Zijlstra
On Tue, Jun 03, 2014 at 07:00:18PM +0200, Peter Zijlstra wrote: On Tue, Jun 03, 2014 at 09:52:22AM -0700, Andy Lutomirski wrote: So you could cheat and set it in pick_next_task_idle() and clear in put_prev_task_idle(), that way the entire idle loop, when running has it set. Isn't

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Andy Lutomirski
On Tue, Jun 3, 2014 at 11:28 AM, Peter Zijlstra pet...@infradead.org wrote: On Tue, Jun 03, 2014 at 07:00:18PM +0200, Peter Zijlstra wrote: On Tue, Jun 03, 2014 at 09:52:22AM -0700, Andy Lutomirski wrote: So you could cheat and set it in pick_next_task_idle() and clear in

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-06-03 Thread Andy Lutomirski
On Tue, Jun 3, 2014 at 11:44 AM, Andy Lutomirski l...@amacapital.net wrote: On Tue, Jun 3, 2014 at 11:28 AM, Peter Zijlstra pet...@infradead.org wrote: On Tue, Jun 03, 2014 at 07:00:18PM +0200, Peter Zijlstra wrote: On Tue, Jun 03, 2014 at 09:52:22AM -0700, Andy Lutomirski wrote: So you

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-05-29 Thread Peter Zijlstra
On Wed, May 28, 2014 at 05:01:41PM -0700, Andy Lutomirski wrote: > On Thu, May 22, 2014 at 6:09 AM, Peter Zijlstra wrote: > > On Thu, May 22, 2014 at 02:58:18PM +0200, Peter Zijlstra wrote: > >> --- > >> diff --git a/kernel/sched/core.c b/kernel/sched/core.c > >> index 4ea7b3f1a087..a5da85fb3570

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-05-29 Thread Peter Zijlstra
On Wed, May 28, 2014 at 05:01:41PM -0700, Andy Lutomirski wrote: On Thu, May 22, 2014 at 6:09 AM, Peter Zijlstra pet...@infradead.org wrote: On Thu, May 22, 2014 at 02:58:18PM +0200, Peter Zijlstra wrote: --- diff --git a/kernel/sched/core.c b/kernel/sched/core.c index

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-05-28 Thread Andy Lutomirski
On Thu, May 22, 2014 at 6:09 AM, Peter Zijlstra wrote: > On Thu, May 22, 2014 at 02:58:18PM +0200, Peter Zijlstra wrote: >> --- >> diff --git a/kernel/sched/core.c b/kernel/sched/core.c >> index 4ea7b3f1a087..a5da85fb3570 100644 >> --- a/kernel/sched/core.c >> +++ b/kernel/sched/core.c >> @@

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-05-28 Thread Andy Lutomirski
On Thu, May 22, 2014 at 6:09 AM, Peter Zijlstra pet...@infradead.org wrote: On Thu, May 22, 2014 at 02:58:18PM +0200, Peter Zijlstra wrote: --- diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 4ea7b3f1a087..a5da85fb3570 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-05-22 Thread Peter Zijlstra
On Thu, May 22, 2014 at 02:58:18PM +0200, Peter Zijlstra wrote: > --- > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 4ea7b3f1a087..a5da85fb3570 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -546,12 +546,38 @@ static bool set_nr_and_not_polling(struct

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-05-22 Thread Peter Zijlstra
On Fri, Apr 11, 2014 at 08:00:23AM -0700, Andy Lutomirski wrote: > > That being said, I think that this addresses once one of the two major > issues. While the race you're fixing is more interesting, I think its > impact is dwarfed by the fact that ttwu_queue_remote completely > ignores polling.

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-05-22 Thread Peter Zijlstra
On Fri, Apr 11, 2014 at 08:00:23AM -0700, Andy Lutomirski wrote: That being said, I think that this addresses once one of the two major issues. While the race you're fixing is more interesting, I think its impact is dwarfed by the fact that ttwu_queue_remote completely ignores polling.

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-05-22 Thread Peter Zijlstra
On Thu, May 22, 2014 at 02:58:18PM +0200, Peter Zijlstra wrote: --- diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 4ea7b3f1a087..a5da85fb3570 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -546,12 +546,38 @@ static bool set_nr_and_not_polling(struct task_struct

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-04-12 Thread Mike Galbraith
On Fri, 2014-04-11 at 15:42 +0200, Peter Zijlstra wrote: > A while ago both Mike and Andy complained that we still get pointless wakeup > IPIs, we had a few patches back and forth but eventually more or less agreed > and then nothing... :-) > > So here's a number of patches that implement

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-04-12 Thread Mike Galbraith
On Fri, 2014-04-11 at 15:42 +0200, Peter Zijlstra wrote: A while ago both Mike and Andy complained that we still get pointless wakeup IPIs, we had a few patches back and forth but eventually more or less agreed and then nothing... :-) So here's a number of patches that implement something

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-04-11 Thread Peter Zijlstra
On Fri, Apr 11, 2014 at 08:00:23AM -0700, Andy Lutomirski wrote: > That being said, I think that this addresses once one of the two major > issues. While the race you're fixing is more interesting, I think its > impact is dwarfed by the fact that ttwu_queue_remote completely > ignores polling.

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-04-11 Thread Andy Lutomirski
On Fri, Apr 11, 2014 at 6:42 AM, Peter Zijlstra wrote: > A while ago both Mike and Andy complained that we still get pointless wakeup > IPIs, we had a few patches back and forth but eventually more or less agreed > and then nothing... :-) > > So here's a number of patches that implement something

[RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-04-11 Thread Peter Zijlstra
A while ago both Mike and Andy complained that we still get pointless wakeup IPIs, we had a few patches back and forth but eventually more or less agreed and then nothing... :-) So here's a number of patches that implement something near what we left off with. Its only been compile/boot tested

[RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-04-11 Thread Peter Zijlstra
A while ago both Mike and Andy complained that we still get pointless wakeup IPIs, we had a few patches back and forth but eventually more or less agreed and then nothing... :-) So here's a number of patches that implement something near what we left off with. Its only been compile/boot tested

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-04-11 Thread Andy Lutomirski
On Fri, Apr 11, 2014 at 6:42 AM, Peter Zijlstra pet...@infradead.org wrote: A while ago both Mike and Andy complained that we still get pointless wakeup IPIs, we had a few patches back and forth but eventually more or less agreed and then nothing... :-) So here's a number of patches that

Re: [RFC][PATCH 0/8] sched,idle: need resched polling rework

2014-04-11 Thread Peter Zijlstra
On Fri, Apr 11, 2014 at 08:00:23AM -0700, Andy Lutomirski wrote: That being said, I think that this addresses once one of the two major issues. While the race you're fixing is more interesting, I think its impact is dwarfed by the fact that ttwu_queue_remote completely ignores polling. (NB: