linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched: don't check rq after newidle_balance return positive
@ 2020-12-15  6:48 chenxg1x
  2020-12-15  8:32 ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: chenxg1x @ 2020-12-15  6:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, bristot, heddchen, xiaoggchen

From: Chen Xiaoguang <xiaoggchen@tencent.com>

In pick_next_task_fair, if CPU is going to idle newidle_balance
is called first trying to pull some tasks.
When newidle_balance returns positive which means it does
pulls tasks or some tasks enqueued then there is no need to check
sched_fair_runnable again.

Signed-off-by: He Chen <heddchen@tencent.com>
Signed-off-by: Xiaoguang Chen <xiaoggchen@tencent.com>
---
 kernel/sched/fair.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index ae7ceba..c2f7eac 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7004,10 +7004,9 @@ struct task_struct *
 	struct task_struct *p;
 	int new_tasks;
 
-again:
 	if (!sched_fair_runnable(rq))
 		goto idle;
-
+again:
 #ifdef CONFIG_FAIR_GROUP_SCHED
 	if (!prev || prev->sched_class != &fair_sched_class)
 		goto simple;
-- 
1.8.3.1


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

* Re: [PATCH] sched: don't check rq after newidle_balance return positive
  2020-12-15  6:48 [PATCH] sched: don't check rq after newidle_balance return positive chenxg1x
@ 2020-12-15  8:32 ` Peter Zijlstra
  2020-12-16  9:44   ` 答复: [PATCH] sched: don't check rq after newidle_balance return positive(Internet mail) xiaoggchen(陈小光)
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2020-12-15  8:32 UTC (permalink / raw)
  To: chenxg1x
  Cc: linux-kernel, mingo, juri.lelli, vincent.guittot,
	dietmar.eggemann, rostedt, bsegall, mgorman, bristot, heddchen,
	xiaoggchen

On Tue, Dec 15, 2020 at 02:48:50PM +0800, chenxg1x@gmail.com wrote:
> From: Chen Xiaoguang <xiaoggchen@tencent.com>
> 
> In pick_next_task_fair, if CPU is going to idle newidle_balance
> is called first trying to pull some tasks.
> When newidle_balance returns positive which means it does
> pulls tasks or some tasks enqueued then there is no need to check
> sched_fair_runnable again.

No, I think it actually does need to, because while it counts the number
of tasks it pulled, it doesn't verify it still has them after it
re-acquires rq->lock. That is, someone could've come along and stolen
them right from under our noses.

> 
> Signed-off-by: He Chen <heddchen@tencent.com>
> Signed-off-by: Xiaoguang Chen <xiaoggchen@tencent.com>

This SoB chain is broken. The first SoB should be the author, but From
does not match.

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

* 答复: [PATCH] sched: don't check rq after newidle_balance return positive(Internet mail)
  2020-12-15  8:32 ` Peter Zijlstra
@ 2020-12-16  9:44   ` xiaoggchen(陈小光)
  0 siblings, 0 replies; 3+ messages in thread
From: xiaoggchen(陈小光) @ 2020-12-16  9:44 UTC (permalink / raw)
  To: Peter Zijlstra, chenxg1x
  Cc: linux-kernel, mingo, juri.lelli, vincent.guittot,
	dietmar.eggemann, rostedt, bsegall, mgorman, bristot,
	heddchen(陈贺)



-----邮件原件-----
发件人: Peter Zijlstra <peterz@infradead.org> 
发送时间: 2020年12月15日 16:33
收件人: chenxg1x@gmail.com
抄送: linux-kernel@vger.kernel.org; mingo@redhat.com; juri.lelli@redhat.com; vincent.guittot@linaro.org; dietmar.eggemann@arm.com; rostedt@goodmis.org; bsegall@google.com; mgorman@suse.de; bristot@redhat.com; heddchen(陈贺) <heddchen@tencent.com>; xiaoggchen(陈小光) <xiaoggchen@tencent.com>
主题: Re: [PATCH] sched: don't check rq after newidle_balance return positive(Internet mail)

On Tue, Dec 15, 2020 at 02:48:50PM +0800, chenxg1x@gmail.com wrote:
>> From: Chen Xiaoguang <xiaoggchen@tencent.com>
>> 
>> In pick_next_task_fair, if CPU is going to idle newidle_balance is 
>> called first trying to pull some tasks.
>> When newidle_balance returns positive which means it does pulls tasks 
>> or some tasks enqueued then there is no need to check 
>> sched_fair_runnable again.

> No, I think it actually does need to, because while it counts the number of tasks it pulled, it doesn't verify it still has them after it re-acquires rq->lock. That is, someone could've come along and stolen them 
> right from under our noses.
Ah, yes, our change only make sense when pulling nothing in load_balance but some tasks enqueued this rq during the lock of this rq is released.
 
Thanks.

>> 
>> Signed-off-by: He Chen <heddchen@tencent.com>
>> Signed-off-by: Xiaoguang Chen <xiaoggchen@tencent.com>

> This SoB chain is broken. The first SoB should be the author, but From does not match.
We will fix this next time.


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

end of thread, other threads:[~2020-12-16  9:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15  6:48 [PATCH] sched: don't check rq after newidle_balance return positive chenxg1x
2020-12-15  8:32 ` Peter Zijlstra
2020-12-16  9:44   ` 答复: [PATCH] sched: don't check rq after newidle_balance return positive(Internet mail) xiaoggchen(陈小光)

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).