linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ultrachin@163.com
To: linux-kernel@vger.kernel.org
Cc: mingo@redhat.com, peterz@infradead.org, 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@tencent.com, xiaoggchen@tencent.com
Subject: [PATCH] sched: pull tasks when CPU is about to run SCHED_IDLE tasks
Date: Wed, 23 Dec 2020 16:09:28 +0800	[thread overview]
Message-ID: <1608710968-31475-1-git-send-email-ultrachin@163.com> (raw)

From: Chen Xiaoguang <xiaoggchen@tencent.com>

Before a CPU switches from running SCHED_NORMAL task to
SCHED_IDLE task, trying to pull SCHED_NORMAL tasks from other
CPU by doing load_balance first.

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

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index ae7ceba..0a26132 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7004,6 +7004,11 @@ struct task_struct *
 	struct task_struct *p;
 	int new_tasks;
 
+	if (prev &&
+	    fair_policy(prev->policy) &&
+	    sched_idle_cpu(rq->cpu))
+		goto idle;
+
 again:
 	if (!sched_fair_runnable(rq))
 		goto idle;
-- 
1.8.3.1



             reply	other threads:[~2020-12-23  9:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-23  8:09 ultrachin [this message]
2020-12-23 11:30 ` [PATCH] sched: pull tasks when CPU is about to run SCHED_IDLE tasks Vincent Guittot
2021-01-11  8:26   ` chin
2021-01-11 11:04     ` Vincent Guittot
2021-01-12  6:57       ` chin
2021-01-12  8:18         ` Vincent Guittot
2021-01-13  3:12           ` chin
2021-01-13  8:30             ` Vincent Guittot
2021-02-02  7:54               ` chin
2021-02-02 15:54                 ` Vincent Guittot
2021-02-03  2:53                   ` chin
2021-02-04  3:57                     ` Jiang Biao
2021-02-04  8:03                       ` Vincent Guittot
2021-02-04  8:01                 ` Vincent Guittot
2021-02-04  8:52                   ` chin
2021-02-04  9:02                     ` Vincent Guittot
2021-02-04  9:13                   ` Jiang Biao
2021-01-11  9:15   ` He Chen
2020-12-27 19:13 ` kernel test robot
2020-12-27 19:42 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1608710968-31475-1-git-send-email-ultrachin@163.com \
    --to=ultrachin@163.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=heddchen@tencent.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=xiaoggchen@tencent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).