[Devel] [PATCH vz9 13/23] sched: Make calc_global_load() return true when it's need to update ve statistic
Nikita Yushchenko
nikita.yushchenko at virtuozzo.com
Fri Oct 1 18:53:21 MSK 2021
From: Kirill Tkhai <ktkhai at virtuozzo.com>
This will be used in next patches to call calc_load_ve() out of jiffies lock.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
=========================
Patchset description:
Make calc_load_ve() be executed out of jiffies_lock
https://jira.sw.ru/browse/PSBM-84967
Kirill Tkhai (3):
sched: Make calc_global_load() return true when it's need to
update ve statistic
sched: Export calc_load_ve()
sched: Call calc_load_ve() out of jiffies_lock
(cherry picked from vz commit b26208e2f8bae0bc539bef9f37d5fc650e47e092)
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
(cherry-picked from vz8 commit c4760068b0a7 ("sched: Make calc_global_load()
return true when it's need to update ve statistic"))
Signed-off-by: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
---
include/linux/sched/loadavg.h | 4 +++-
kernel/sched/loadavg.c | 5 +++--
kernel/time/timekeeping.c | 4 ++--
kernel/time/timekeeping.h | 2 +-
4 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/include/linux/sched/loadavg.h b/include/linux/sched/loadavg.h
index 83ec54b65e79..58cca1cef579 100644
--- a/include/linux/sched/loadavg.h
+++ b/include/linux/sched/loadavg.h
@@ -2,6 +2,8 @@
#ifndef _LINUX_SCHED_LOADAVG_H
#define _LINUX_SCHED_LOADAVG_H
+#include <linux/types.h>
+
/*
* These are the constant used to fake the fixed-point load-average
* counting. Some notes:
@@ -43,6 +45,6 @@ extern unsigned long calc_load_n(unsigned long load, unsigned long exp,
#define LOAD_INT(x) ((x) >> FSHIFT)
#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
-extern void calc_global_load(void);
+extern bool calc_global_load(void);
#endif /* _LINUX_SCHED_LOADAVG_H */
diff --git a/kernel/sched/loadavg.c b/kernel/sched/loadavg.c
index 954b229868d9..62a463cb5cab 100644
--- a/kernel/sched/loadavg.c
+++ b/kernel/sched/loadavg.c
@@ -347,14 +347,14 @@ static inline void calc_global_nohz(void) { }
*
* Called from the global timer code.
*/
-void calc_global_load(void)
+bool calc_global_load(void)
{
unsigned long sample_window;
long active, delta;
sample_window = READ_ONCE(calc_load_update);
if (time_before(jiffies, sample_window + 10))
- return;
+ return false;
/*
* Fold the 'old' NO_HZ-delta to include all NO_HZ CPUs.
@@ -377,6 +377,7 @@ void calc_global_load(void)
* catch up in bulk.
*/
calc_global_nohz();
+ return true;
}
/*
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 8a364aa9881a..e5c4800447d7 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -2264,10 +2264,10 @@ EXPORT_SYMBOL(ktime_get_coarse_ts64);
/*
* Must hold jiffies_lock
*/
-void do_timer(unsigned long ticks)
+bool do_timer(unsigned long ticks)
{
jiffies_64 += ticks;
- calc_global_load();
+ return calc_global_load();
}
/**
diff --git a/kernel/time/timekeeping.h b/kernel/time/timekeeping.h
index 543beba096c7..fcecd50da2e3 100644
--- a/kernel/time/timekeeping.h
+++ b/kernel/time/timekeeping.h
@@ -22,8 +22,8 @@ static inline int sched_clock_suspend(void) { return 0; }
static inline void sched_clock_resume(void) { }
#endif
+extern bool do_timer(unsigned long ticks);
extern void update_process_times(int user);
-extern void do_timer(unsigned long ticks);
extern void update_wall_time(void);
extern raw_spinlock_t jiffies_lock;
--
2.30.2
More information about the Devel
mailing list