linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/rt: Decrease number of calls of push_rt_task() in push_rt_tasks()
@ 2013-01-27 23:46 Kirill Tkhai
  2013-01-31 16:08 ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Kirill Tkhai @ 2013-01-27 23:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: Steven Rostedt, Ingo Molnar, Peter Zijlstra, linux-rt-users

The patch aims to decrease the number of calls of push_rt_task()
in push_rt_tasks().

It's not necessary to push more than 'num_online_cpus() - 1' tasks.
If just pushed task doesn't leave its new CPU during our local call
of push_rt_tasks() than we won't push another task to the CPU.
If it leave or change priority than it will pull new task by itself.

Signed-off-by: Kirill V Tkhai <tkhai@yandex.ru>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: Ingo Molnar <mingo@kernel.org>
CC: Peter Zijlstra <peterz@infradead.org>
CC: linux-rt-users <linux-rt-users@vger.kernel.org>
---
 kernel/sched/rt.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 4e8f0f4..edf046d 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1703,8 +1703,10 @@ out:
 
 static void push_rt_tasks(struct rq *rq)
 {
+	int num_cpus = num_online_cpus() - 1;
+
 	/* push_rt_task will return true if it moved an RT */
-	while (push_rt_task(rq))
+	while (push_rt_task(rq) && --num_cpus > 0)
 		;
 }
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] sched/rt: Decrease number of calls of push_rt_task() in push_rt_tasks()
  2013-01-27 23:46 [PATCH] sched/rt: Decrease number of calls of push_rt_task() in push_rt_tasks() Kirill Tkhai
@ 2013-01-31 16:08 ` Steven Rostedt
  2013-01-31 21:57   ` Kirill Tkhai
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2013-01-31 16:08 UTC (permalink / raw)
  To: Kirill Tkhai; +Cc: linux-kernel, Ingo Molnar, Peter Zijlstra, linux-rt-users

On Mon, 2013-01-28 at 03:46 +0400, Kirill Tkhai wrote:
> The patch aims to decrease the number of calls of push_rt_task()
> in push_rt_tasks().
> 
> It's not necessary to push more than 'num_online_cpus() - 1' tasks.
> If just pushed task doesn't leave its new CPU during our local call
> of push_rt_tasks() than we won't push another task to the CPU.
> If it leave or change priority than it will pull new task by itself.

I'm curious. Have you hit situations where this was an issue? Or was
this just discovered by code review?

-- Steve

> 
> Signed-off-by: Kirill V Tkhai <tkhai@yandex.ru>
> CC: Steven Rostedt <rostedt@goodmis.org>
> CC: Ingo Molnar <mingo@kernel.org>
> CC: Peter Zijlstra <peterz@infradead.org>
> CC: linux-rt-users <linux-rt-users@vger.kernel.org>
> ---
>  kernel/sched/rt.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index 4e8f0f4..edf046d 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -1703,8 +1703,10 @@ out:
>  
>  static void push_rt_tasks(struct rq *rq)
>  {
> +	int num_cpus = num_online_cpus() - 1;
> +
>  	/* push_rt_task will return true if it moved an RT */
> -	while (push_rt_task(rq))
> +	while (push_rt_task(rq) && --num_cpus > 0)
>  		;
>  }
>  



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sched/rt: Decrease number of calls of push_rt_task() in push_rt_tasks()
  2013-01-31 16:08 ` Steven Rostedt
@ 2013-01-31 21:57   ` Kirill Tkhai
  2013-02-05  3:37     ` Honghui Zhang
  0 siblings, 1 reply; 5+ messages in thread
From: Kirill Tkhai @ 2013-01-31 21:57 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-kernel, Ingo Molnar, Peter Zijlstra, linux-rt-users



31.01.2013, 20:08, "Steven Rostedt" <rostedt@goodmis.org>:
> On Mon, 2013-01-28 at 03:46 +0400, Kirill Tkhai wrote:
>
>>  The patch aims to decrease the number of calls of push_rt_task()
>>  in push_rt_tasks().
>>
>>  It's not necessary to push more than 'num_online_cpus() - 1' tasks.
>>  If just pushed task doesn't leave its new CPU during our local call
>>  of push_rt_tasks() than we won't push another task to the CPU.
>>  If it leave or change priority than it will pull new task by itself.
>
> I'm curious. Have you hit situations where this was an issue? Or was
> this just discovered by code review?

No, I did't hit this situation. It's impossible to hook every situation.

Thanks for your explanation.

Kirill

>
> -- Steve
>
>>  Signed-off-by: Kirill V Tkhai <tkhai@yandex.ru>
>>  CC: Steven Rostedt <rostedt@goodmis.org>
>>  CC: Ingo Molnar <mingo@kernel.org>
>>  CC: Peter Zijlstra <peterz@infradead.org>
>>  CC: linux-rt-users <linux-rt-users@vger.kernel.org>
>>  ---
>>   kernel/sched/rt.c |    4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>  diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
>>  index 4e8f0f4..edf046d 100644
>>  --- a/kernel/sched/rt.c
>>  +++ b/kernel/sched/rt.c
>>  @@ -1703,8 +1703,10 @@ out:
>>
>>   static void push_rt_tasks(struct rq *rq)
>>   {
>>  + int num_cpus = num_online_cpus() - 1;
>>  +
>>           /* push_rt_task will return true if it moved an RT */
>>  - while (push_rt_task(rq))
>>  + while (push_rt_task(rq) && --num_cpus > 0)
>>                   ;
>>   }

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sched/rt: Decrease number of calls of push_rt_task() in push_rt_tasks()
  2013-01-31 21:57   ` Kirill Tkhai
@ 2013-02-05  3:37     ` Honghui Zhang
  0 siblings, 0 replies; 5+ messages in thread
From: Honghui Zhang @ 2013-02-05  3:37 UTC (permalink / raw)
  To: Kirill Tkhai
  Cc: Steven Rostedt, linux-kernel, Ingo Molnar, Peter Zijlstra,
	linux-rt-users

On 2013/2/1 5:57, Kirill Tkhai wrote:
> 
> 
> 31.01.2013, 20:08, "Steven Rostedt" <rostedt@goodmis.org>:
>> On Mon, 2013-01-28 at 03:46 +0400, Kirill Tkhai wrote:
>>
>>>  The patch aims to decrease the number of calls of push_rt_task()
>>>  in push_rt_tasks().
>>>
>>>  It's not necessary to push more than 'num_online_cpus() - 1' tasks.
>>>  If just pushed task doesn't leave its new CPU during our local call
>>>  of push_rt_tasks() than we won't push another task to the CPU.
>>>  If it leave or change priority than it will pull new task by itself.
>>
>> I'm curious. Have you hit situations where this was an issue? Or was
>> this just discovered by code review?
> 
> No, I did't hit this situation. It's impossible to hook every situation.
> 
> Thanks for your explanation.
> 
> Kirill
> 

Suppose we have a large number of cpus(say 4096), with the last one running
a low-priority task on it. Is it possible with this patch we will never reach
the last cpu in case that previous cpu has complete the pulled task?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sched/rt: Decrease number of calls of push_rt_task() in push_rt_tasks()
  2013-02-05  7:22 Kirill Tkhai
@ 2013-02-05  8:25 ` Honghui Zhang
  0 siblings, 0 replies; 5+ messages in thread
From: Honghui Zhang @ 2013-02-05  8:25 UTC (permalink / raw)
  To: Kirill Tkhai
  Cc: Steven Rostedt, linux-kernel, Ingo Molnar, Peter Zijlstra,
	linux-rt-users

On 2013/2/5 15:22, Kirill Tkhai wrote:
>>
>> Suppose we have a large number of cpus(say 4096), with the last one running
>> a low-priority task on it. Is it possible with this patch we will never reach
>> the last cpu in case that previous cpu has complete the pulled task?
> 
> Yes. But this patch is about several pushable tasks on the same cpu.
> 
> Kirill
> 

Maybe I haven't make myself understood, but in that case, there will be a higher-priority
task in the runqueue of the pushing cpu, and a lower-priority task running in the last cpu
which could not be preempt by push_rt_task(),  I don't think it's acceptable.

Hans



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-02-05  8:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-27 23:46 [PATCH] sched/rt: Decrease number of calls of push_rt_task() in push_rt_tasks() Kirill Tkhai
2013-01-31 16:08 ` Steven Rostedt
2013-01-31 21:57   ` Kirill Tkhai
2013-02-05  3:37     ` Honghui Zhang
2013-02-05  7:22 Kirill Tkhai
2013-02-05  8:25 ` [PATCH] " Honghui Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).