From: "tip-bot2 for Johannes Weiner" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Chengming Zhou <zhouchengming@bytedance.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: sched/core] psi: Pressure states are unlikely
Date: Thu, 04 Mar 2021 09:09:11 -0000 [thread overview]
Message-ID: <161484895180.398.11244199191413169708.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20210303034659.91735-4-zhouchengming@bytedance.com>
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 24f3cb558f59debe0e9159459bb9627b51b47c17
Gitweb: https://git.kernel.org/tip/24f3cb558f59debe0e9159459bb9627b51b47c17
Author: Johannes Weiner <hannes@cmpxchg.org>
AuthorDate: Wed, 03 Mar 2021 11:46:58 +08:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Thu, 04 Mar 2021 09:56:02 +01:00
psi: Pressure states are unlikely
Move the unlikely branches out of line. This eliminates undesirable
jumps during wakeup and sleeps for workloads that aren't under any
sort of resource pressure.
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20210303034659.91735-4-zhouchengming@bytedance.com
---
kernel/sched/psi.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index 0fe6ff6..3907a6b 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -219,17 +219,17 @@ static bool test_state(unsigned int *tasks, enum psi_states state)
{
switch (state) {
case PSI_IO_SOME:
- return tasks[NR_IOWAIT];
+ return unlikely(tasks[NR_IOWAIT]);
case PSI_IO_FULL:
- return tasks[NR_IOWAIT] && !tasks[NR_RUNNING];
+ return unlikely(tasks[NR_IOWAIT] && !tasks[NR_RUNNING]);
case PSI_MEM_SOME:
- return tasks[NR_MEMSTALL];
+ return unlikely(tasks[NR_MEMSTALL]);
case PSI_MEM_FULL:
- return tasks[NR_MEMSTALL] && !tasks[NR_RUNNING];
+ return unlikely(tasks[NR_MEMSTALL] && !tasks[NR_RUNNING]);
case PSI_CPU_SOME:
- return tasks[NR_RUNNING] > tasks[NR_ONCPU];
+ return unlikely(tasks[NR_RUNNING] > tasks[NR_ONCPU]);
case PSI_CPU_FULL:
- return tasks[NR_RUNNING] && !tasks[NR_ONCPU];
+ return unlikely(tasks[NR_RUNNING] && !tasks[NR_ONCPU]);
case PSI_NONIDLE:
return tasks[NR_IOWAIT] || tasks[NR_MEMSTALL] ||
tasks[NR_RUNNING];
@@ -729,7 +729,7 @@ static void psi_group_change(struct psi_group *group, int cpu,
* task in a cgroup is in_memstall, the corresponding groupc
* on that cpu is in PSI_MEM_FULL state.
*/
- if (groupc->tasks[NR_ONCPU] && cpu_curr(cpu)->in_memstall)
+ if (unlikely(groupc->tasks[NR_ONCPU] && cpu_curr(cpu)->in_memstall))
state_mask |= (1 << PSI_MEM_FULL);
groupc->state_mask = state_mask;
next prev parent reply other threads:[~2021-03-04 9:10 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-03 3:46 [PATCH v2 0/4] psi: Add PSI_CPU_FULL state and some code optimization Chengming Zhou
2021-03-03 3:46 ` [PATCH v2 1/4] psi: Add PSI_CPU_FULL state Chengming Zhou
2021-03-04 9:09 ` [tip: sched/core] " tip-bot2 for Chengming Zhou
2021-03-06 11:42 ` tip-bot2 for Chengming Zhou
2021-03-03 3:46 ` [PATCH v2 2/4] psi: Use ONCPU state tracking machinery to detect reclaim Chengming Zhou
2021-03-03 14:56 ` Johannes Weiner
2021-03-03 15:52 ` Peter Zijlstra
2021-03-04 9:09 ` [tip: sched/core] " tip-bot2 for Chengming Zhou
2021-03-06 11:42 ` tip-bot2 for Chengming Zhou
2021-03-03 3:46 ` [PATCH v2 3/4] psi: pressure states are unlikely Chengming Zhou
2021-03-04 9:09 ` tip-bot2 for Johannes Weiner [this message]
2021-03-06 11:42 ` [tip: sched/core] psi: Pressure " tip-bot2 for Johannes Weiner
2021-03-03 3:46 ` [PATCH v2 4/4] psi: Optimize task switch inside shared cgroups Chengming Zhou
2021-03-03 14:57 ` Johannes Weiner
2021-03-03 15:53 ` Peter Zijlstra
2021-03-03 16:01 ` [External] " Muchun Song
2021-03-04 9:09 ` [tip: sched/core] " tip-bot2 for Chengming Zhou
2021-03-06 11:42 ` tip-bot2 for Chengming Zhou
2021-03-03 14:59 ` [PATCH v2 0/4] psi: Add PSI_CPU_FULL state and some code optimization Johannes Weiner
2021-03-03 15:32 ` Peter Zijlstra
2021-03-03 16:05 ` Peter Zijlstra
2021-03-03 19:38 ` Johannes Weiner
2021-03-04 0:14 ` [External] " Chengming Zhou
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=161484895180.398.11244199191413169708.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=x86@kernel.org \
--cc=zhouchengming@bytedance.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).