From: "tip-bot2 for Alexey Dobriyan" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
Ingo Molnar <mingo@kernel.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: sched/core] sched: Make nr_running() return 32-bit value
Date: Wed, 12 May 2021 20:01:47 -0000 [thread overview]
Message-ID: <162084970734.29796.6875060189702159404.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20210422200228.1423391-1-adobriyan@gmail.com>
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 01aee8fd7fb23049e2b52abadbe1f7b5e94a52d2
Gitweb: https://git.kernel.org/tip/01aee8fd7fb23049e2b52abadbe1f7b5e94a52d2
Author: Alexey Dobriyan <adobriyan@gmail.com>
AuthorDate: Thu, 22 Apr 2021 23:02:25 +03:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Wed, 12 May 2021 21:34:14 +02:00
sched: Make nr_running() return 32-bit value
Creating 2**32 tasks is impossible due to futex pid limits and wasteful
anyway. Nobody has done it.
Bring nr_running() into 32-bit world to save on REX prefixes.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20210422200228.1423391-1-adobriyan@gmail.com
---
fs/proc/loadavg.c | 2 +-
fs/proc/stat.c | 2 +-
include/linux/sched/stat.h | 2 +-
kernel/sched/core.c | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/proc/loadavg.c b/fs/proc/loadavg.c
index 8468bae..f32878d 100644
--- a/fs/proc/loadavg.c
+++ b/fs/proc/loadavg.c
@@ -16,7 +16,7 @@ static int loadavg_proc_show(struct seq_file *m, void *v)
get_avenrun(avnrun, FIXED_1/200, 0);
- seq_printf(m, "%lu.%02lu %lu.%02lu %lu.%02lu %ld/%d %d\n",
+ seq_printf(m, "%lu.%02lu %lu.%02lu %lu.%02lu %u/%d %d\n",
LOAD_INT(avnrun[0]), LOAD_FRAC(avnrun[0]),
LOAD_INT(avnrun[1]), LOAD_FRAC(avnrun[1]),
LOAD_INT(avnrun[2]), LOAD_FRAC(avnrun[2]),
diff --git a/fs/proc/stat.c b/fs/proc/stat.c
index f25e853..941605d 100644
--- a/fs/proc/stat.c
+++ b/fs/proc/stat.c
@@ -200,7 +200,7 @@ static int show_stat(struct seq_file *p, void *v)
"\nctxt %llu\n"
"btime %llu\n"
"processes %lu\n"
- "procs_running %lu\n"
+ "procs_running %u\n"
"procs_blocked %lu\n",
nr_context_switches(),
(unsigned long long)boottime.tv_sec,
diff --git a/include/linux/sched/stat.h b/include/linux/sched/stat.h
index 939c3ec..73606b3 100644
--- a/include/linux/sched/stat.h
+++ b/include/linux/sched/stat.h
@@ -17,7 +17,7 @@ extern unsigned long total_forks;
extern int nr_threads;
DECLARE_PER_CPU(unsigned long, process_counts);
extern int nr_processes(void);
-extern unsigned long nr_running(void);
+extern unsigned int nr_running(void);
extern bool single_task_running(void);
extern unsigned long nr_iowait(void);
extern unsigned long nr_iowait_cpu(int cpu);
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index ac8882d..2c6cdb0 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4692,9 +4692,9 @@ context_switch(struct rq *rq, struct task_struct *prev,
* externally visible scheduler statistics: current number of runnable
* threads, total number of context switches performed since bootup.
*/
-unsigned long nr_running(void)
+unsigned int nr_running(void)
{
- unsigned long i, sum = 0;
+ unsigned int i, sum = 0;
for_each_online_cpu(i)
sum += cpu_rq(i)->nr_running;
next prev parent reply other threads:[~2021-05-12 20:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-22 20:02 [PATCH 1/4] sched: make nr_running() return 32-bit Alexey Dobriyan
2021-04-22 20:02 ` [PATCH 2/4] sched: make nr_iowait() return 32-bit value Alexey Dobriyan
2021-05-12 20:01 ` [tip: sched/core] sched: Make " tip-bot2 for Alexey Dobriyan
2021-04-22 20:02 ` [PATCH 3/4] sched: make nr_iowait_cpu() return 32-bit Alexey Dobriyan
2021-05-12 20:01 ` [tip: sched/core] sched: Make nr_iowait_cpu() return 32-bit value tip-bot2 for Alexey Dobriyan
2021-04-22 20:02 ` [PATCH 4/4] sched: make multiple runqueue task counters 32-bit Alexey Dobriyan
2021-05-12 19:36 ` Ingo Molnar
2021-05-12 20:01 ` [tip: sched/core] sched: Make " tip-bot2 for Alexey Dobriyan
2021-05-12 20:01 ` tip-bot2 for Alexey Dobriyan [this message]
2021-05-12 23:58 ` [PATCH 1/4] sched: make nr_running() return 32-bit Thomas Gleixner
2021-05-13 7:23 ` Alexey Dobriyan
2021-05-13 9:58 ` Ingo Molnar
2021-05-13 21:22 ` Alexey Dobriyan
2021-05-14 12:52 ` Thomas Gleixner
2021-05-14 18:18 ` Thomas Gleixner
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=162084970734.29796.6875060189702159404.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=adobriyan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=x86@kernel.org \
/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).