From 8cbbd36a38c2ecb8f36a6b9318ae4ff1227d5497 Mon Sep 17 00:00:00 2001 From: zgpeng Date: Thu, 12 Nov 2020 14:39:06 +0800 Subject: [PATCH] proc: fix the display error of the processes field in /proc/stat Signed-off-by: zhiguang peng --- fs/proc/bt_stat.c | 2 +- fs/proc/stat.c | 2 +- include/linux/sched/stat.h | 2 +- kernel/fork.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/proc/bt_stat.c b/fs/proc/bt_stat.c index 49b64f774..cf8874687 100644 --- a/fs/proc/bt_stat.c +++ b/fs/proc/bt_stat.c @@ -118,7 +118,7 @@ static int show_bt_stat(struct seq_file *p, void *v) seq_printf(p, "\nctxt %llu\n" "btime %lu\n" - "processes %d\n" + "processes %lu\n" "procs_running %lu\n" "procs_blocked %lu\n", nr_context_switches(), diff --git a/fs/proc/stat.c b/fs/proc/stat.c index d57a3dea1..8ac8b768f 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c @@ -169,7 +169,7 @@ static int show_stat(struct seq_file *p, void *v) seq_printf(p, "\nctxt %llu\n" "btime %llu\n" - "processes %d\n" + "processes %lu\n" "procs_running %lu\n" "procs_blocked %lu\n", nr_context_switches(), diff --git a/include/linux/sched/stat.h b/include/linux/sched/stat.h index e17ebf7ac..a605065d6 100644 --- a/include/linux/sched/stat.h +++ b/include/linux/sched/stat.h @@ -15,7 +15,7 @@ DECLARE_PER_CPU(unsigned long, total_forks); extern int nr_threads; DECLARE_PER_CPU(unsigned long, process_counts); -extern int nr_forks(void); +extern unsigned long nr_forks(void); extern int nr_processes(void); extern unsigned long nr_running(void); extern unsigned long nr_running_cpu(int cpu); diff --git a/kernel/fork.c b/kernel/fork.c index c7a909323..9e6967c3d 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -133,10 +133,10 @@ int lockdep_tasklist_lock_is_held(void) EXPORT_SYMBOL_GPL(lockdep_tasklist_lock_is_held); #endif /* #ifdef CONFIG_PROVE_RCU */ -int nr_forks(void) +unsigned long nr_forks(void) { int cpu; - int total = 0; + unsigned long total = 0; for_each_possible_cpu(cpu) total += per_cpu(total_forks, cpu);